/*
 * GoJS v2.1.34 JavaScript Library for HTML Diagrams, https://gojs.net
 * GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation, https://www.nwoods.com.
 * Copyright (C) 1998-2021 by Northwoods Software Corporation.  All Rights Reserved.
 * THIS SOFTWARE IS LICENSED.  THE LICENSE AGREEMENT IS AT: https://gojs.net/2.1.34/license.html.
 * DO NOT MODIFY THIS FILE.  DO NOT DISTRIBUTE A MODIFIED COPY OF THE CONTENTS OF THIS FILE.
 */
(function() { var t;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function ca(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}}function da(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c}var ea="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b},fa;
if("function"==typeof Object.setPrototypeOf)fa=Object.setPrototypeOf;else{var ha;a:{var ia={a:!0},ja={};try{ja.__proto__=ia;ha=ja.a;break a}catch(a){}ha=!1}fa=ha?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var ka=fa;
function la(a,b){a.prototype=ea(b.prototype);a.prototype.constructor=a;if(ka)ka(a,b);else for(var c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.KB=b.prototype}var ma="undefined"!=typeof window&&window===self?self:"undefined"!=typeof global&&null!=global?global:self,na="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};
function pa(a){if(a){for(var b=ma,c=["Array","prototype","fill"],d=0;d<c.length-1;d++){var e=c[d];e in b||(b[e]={});b=b[e]}c=c[c.length-1];d=b[c];a=a(d);a!=d&&null!=a&&na(b,c,{configurable:!0,writable:!0,value:a})}}pa(function(a){return a?a:function(a,c,d){var b=this.length||0;0>c&&(c=Math.max(0,b+c));if(null==d||d>b)d=b;d=Number(d);0>d&&(d=Math.max(0,b+d));for(c=Number(c||0);c<d;c++)this[c]=a;return this}});var qa="object"===typeof self&&self.self===self&&self||"object"===typeof global&&global.global===global&&global||"object"===typeof window&&window.window===window&&window||{};void 0===qa.requestAnimationFrame&&(void 0===qa.setImmediate?qa.requestAnimationFrame=function(a){qa.setTimeout(a,0)}:qa.requestAnimationFrame=qa.setImmediate);function ra(){}function sa(a,b){var c=-1;return function(){var d=this,e=arguments;-1!==c&&qa.clearTimeout(c);c=ta(function(){c=-1;a.apply(d,e)},b)}}
function ta(a,b){return qa.setTimeout(a,b)}function ua(a){return qa.document.createElement(a)}function v(a){throw Error(a);}function va(a,b){a="The object is frozen, so its properties cannot be set: "+a.toString();void 0!==b&&(a+="  to value: "+b);v(a)}function x(a,b,c,d){a instanceof b||(c=wa(c),void 0!==d&&(c+="."+d),xa(a,b,c))}function A(a,b,c,d){typeof a!==b&&(c=wa(c),void 0!==d&&(c+="."+d),xa(a,b,c))}
function C(a,b,c){"number"===typeof a&&isFinite(a)||(b=wa(b),void 0!==c&&(b+="."+c),v(b+" must be a real number type, and not NaN or Infinity: "+a))}function xa(a,b,c,d){b=wa(b);c=wa(c);void 0!==d&&(c+="."+d);"string"===typeof a?v(c+" value is not an instance of "+b+': "'+a+'"'):v(c+" value is not an instance of "+b+": "+a)}function ya(a,b,c,d){c=wa(c);void 0!==d&&(c+="."+d);v(c+" is not in the range "+b+": "+a)}
function za(a){v(("string"===typeof a.className?a.className:"")+" constructor cannot take any arguments.")}function Aa(a){v("Collection was modified during iteration: "+a.toString()+"\n  Perhaps you should iterate over a copy of the collection,\n  or you could collect items to be removed from the collection after the iteration.")}function Ba(a,b){v("No property to set for this enum value: "+b+" on "+a.toString())}function Ca(a){qa.console&&qa.console.log(a)}
function Da(){qa.console&&qa.console.log("Warning: List/Map/Set constructors no longer take an argument that enforces type.Instead they take an optional collection of Values to add to the collection. See 2.0 changelog for details.")}function Fa(a){return"object"===typeof a&&null!==a}function Ga(a){return Array.isArray(a)||qa.NodeList&&a instanceof qa.NodeList||qa.HTMLCollection&&a instanceof qa.HTMLCollection}function Ha(a,b,c){Ga(a)||xa(a,"Array or NodeList or HTMLCollection",b,c)}
function Ia(a){return Array.prototype.slice.call(a)}function Ja(a,b,c){Array.isArray(a)?b>=a.length?a.push(c):a.splice(b,0,c):v("Cannot insert an object into an HTMLCollection or NodeList: "+c+" at "+b)}function Ka(a,b){Array.isArray(a)?b>=a.length?a.pop():a.splice(b,1):v("Cannot remove an object from an HTMLCollection or NodeList at "+b)}function La(){var a=Na.pop();return void 0===a?[]:a}function Oa(a){a.length=0;Na.push(a)}
function wa(a){return null===a?"*":"string"===typeof a?a:"function"===typeof a&&"string"===typeof a.className?a.className:""}function Pa(a){if("function"===typeof a){if(a.className)return a.className;if(a.name)return a.name;var b=a.toString();b=b.substring(9,b.indexOf("(")).trim();if(""!==b)return a._className=b}else if(Fa(a)&&a.constructor)return Pa(a.constructor);return typeof a}
function Qa(a){var b=a;Fa(a)&&(a.text?b=a.text:a.name?b=a.name:void 0!==a.key?b=a.key:void 0!==a.id?b=a.id:a.constructor===Object&&(a.Text?b=a.Text:a.Name?b=a.Name:void 0!==a.Key?b=a.Key:void 0!==a.Id?b=a.Id:void 0!==a.ID&&(b=a.ID)));return void 0===b?"undefined":null===b?"null":b.toString()}function Ra(a,b){if(a.hasOwnProperty(b))return!0;for(a=Object.getPrototypeOf(a);a&&a!==Function;){if(a.hasOwnProperty(b))return!0;var c=a.AB;if(c&&c[b])return!0;a=Object.getPrototypeOf(a)}return!1}
function Sa(a,b,c){Object.defineProperty(Ta.prototype,a,{get:b,set:c})}function Ua(){var a=Xa;if(void 0===qa.document)return a;if(0===a.length)for(var b=qa.document.getElementsByTagName("canvas"),c=b.length,d=0;d<c;d++){var e=b[d];e.parentElement&&e.parentElement.B&&a.push(e.parentElement.B)}return a}
function Ya(a){for(var b=[],c=0;256>c;c++)b["0123456789abcdef".charAt(c>>4)+"0123456789abcdef".charAt(c&15)]=String.fromCharCode(c);a.length%2&&(a="0"+a);c=[];for(var d=0,e=0;e<a.length;e+=2)c[d++]=b[a.substr(e,2)];a=c.join("");a=""===a?"0":a;b=[];for(c=0;256>c;c++)b[c]=c;for(c=d=0;256>c;c++)d=(d+b[c]+119)%256,e=b[c],b[c]=b[d],b[d]=e;d=c=0;for(var f="",g=0;g<a.length;g++)c=(c+1)%256,d=(d+b[c])%256,e=b[c],b[c]=b[d],b[d]=e,f+=String.fromCharCode(a.charCodeAt(g)^b[(b[c]+b[d])%256]);return f}
var Za=void 0!==qa.navigator&&0<qa.navigator.userAgent.indexOf("MSIE 9.0"),$a=void 0!==qa.navigator&&0<qa.navigator.userAgent.indexOf("MSIE 10.0"),bb=void 0!==qa.navigator&&0<qa.navigator.userAgent.indexOf("Trident/7"),cb=void 0!==qa.navigator&&0<qa.navigator.userAgent.indexOf("Edge/"),db=void 0!==qa.navigator&&void 0!==qa.navigator.platform&&0<=qa.navigator.platform.toUpperCase().indexOf("MAC"),eb=void 0!==qa.navigator&&void 0!==qa.navigator.platform&&null!==qa.navigator.platform.match(/(iPhone|iPod|iPad)/i),
Na=[];Object.freeze([]);var Xa=[];ra.className="Util";ra.Dx="32ab5ff3b26f42dc0ed90f21442913b5";ra.adym="gojs.net";ra.vfo="28e647fdb062";ra.className="Util";function E(a,b,c){fb(this);this.l=a;this.Wa=b;this.w=c}E.prototype.toString=function(){return"EnumValue."+this.Wa};function gb(a,b){return void 0===b||null===b||""===b?null:a[b]}function hb(a,b,c,d){a.classType!==b&&(c=wa(c),void 0!==d&&(c+="."+d),xa(a,"function"==="a constant of class "+typeof b.className?b.className:"",c))}
ma.Object.defineProperties(E.prototype,{classType:{configurable:!0,get:function(){return this.l}},name:{configurable:!0,get:function(){return this.Wa}},value:{configurable:!0,get:function(){return this.w}}});E.className="EnumValue";function ib(){this.Ex=[]}ib.prototype.toString=function(){return this.Ex.join("")};ib.prototype.add=function(a){""!==a&&this.Ex.push(a)};ib.className="StringBuilder";function jb(){}jb.className="PropertyCollection";
var F={Dm:!1,zy:!1,dA:!1,DB:!1,HB:!1,Py:!1,yy:!1,BB:null,trace:function(a){qa.console&&qa.console.log(a)},CB:function(a,b,c,d){a.strokeStyle="red";a.fillStyle="red";a.font="8px sans-serif";a.beginPath();a.moveTo(-10,0);a.lineTo(10,0);a.moveTo(0,-10);a.lineTo(0,10);a.stroke();a.setTransform(1,0,0,1,0,0);a.scale(c,c);a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy);a.lineWidth=2;a.beginPath();a.moveTo(d.left,d.top+20);a.lineTo(d.left,d.top);a.lineTo(d.left+20,d.top);a.moveTo(d.right,d.bottom-20);a.lineTo(d.right,
d.bottom);a.lineTo(d.right-20,d.bottom);a.stroke();a.fillText("DB: "+Math.round(d.x)+", "+Math.round(d.y)+", "+Math.round(d.width)+", "+Math.round(d.height),d.left,d.top-5)},Iz:function(a){var b={},c;for(c in a){b.x=c;if("licenseKey"!==b.x){var d=a[b.x];if(void 0!==d.prototype){b.Wm=Object.getOwnPropertyNames(d.prototype);for(var e={Ik:0};e.Ik<b.Wm.length;e={Ik:e.Ik},e.Ik++){var f=Object.getOwnPropertyDescriptor(d.prototype,b.Wm[e.Ik]);void 0!==f.get&&void 0===f.set&&Object.defineProperty(d.prototype,
b.Wm[e.Ik],{set:function(a,b){return function(){throw Error("Property "+a.Wm[b.Ik]+" of "+a.x+" is read-only.");}}(b,e)})}}}b={Wm:b.Wm,x:b.x}}}};function kb(){}kb.prototype.reset=function(){};kb.prototype.next=function(){return!1};kb.prototype.rd=function(){return!1};kb.prototype.first=function(){return null};kb.prototype.any=function(){return!1};kb.prototype.all=function(){return!0};kb.prototype.each=function(){return this};kb.prototype.map=function(){return this};kb.prototype.filter=function(){return this};
kb.prototype.Qd=function(){};kb.prototype.toString=function(){return"EmptyIterator"};ma.Object.defineProperties(kb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return 0}}});kb.prototype.first=kb.prototype.first;kb.prototype.hasNext=kb.prototype.rd;kb.prototype.next=kb.prototype.next;kb.prototype.reset=kb.prototype.reset;var lb=null;kb.className="EmptyIterator";lb=new kb;function mb(a){this.key=-1;this.value=a}
mb.prototype.reset=function(){this.key=-1};mb.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};mb.prototype.rd=function(){return this.next()};mb.prototype.first=function(){this.key=0;return this.value};mb.prototype.any=function(a){this.key=-1;return a(this.value)};mb.prototype.all=function(a){this.key=-1;return a(this.value)};mb.prototype.each=function(a){this.key=-1;a(this.value);return this};mb.prototype.map=function(a){return new mb(a(this.value))};
mb.prototype.filter=function(a){return a(this.value)?new mb(this.value):lb};mb.prototype.Qd=function(){this.value=null};mb.prototype.toString=function(){return"SingletonIterator("+this.value+")"};ma.Object.defineProperties(mb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return 1}}});mb.prototype.first=mb.prototype.first;mb.prototype.hasNext=mb.prototype.rd;mb.prototype.next=mb.prototype.next;
mb.prototype.reset=mb.prototype.reset;mb.className="SingletonIterator";function nb(a){this.wb=a;this.sf=null;a.Ma=null;this.oa=a.u;this.Va=-1}nb.prototype.reset=function(){var a=this.wb;a.Ma=null;this.oa=a.u;this.Va=-1};nb.prototype.next=function(){var a=this.wb;if(a.u!==this.oa){if(0>this.key)return!1;Aa(a)}a=a.j;var b=a.length,c=++this.Va,d=this.sf;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.Va=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.Qd()}return!1};
nb.prototype.rd=function(){return this.next()};nb.prototype.first=function(){var a=this.wb;this.oa=a.u;this.Va=0;a=a.j;var b=a.length,c=this.sf;if(null!==c){for(var d=0;d<b;){var e=a[d];if(c(e))return this.key=this.Va=d,this.value=e;d++}return null}return 0<b?(a=a[0],this.key=0,this.value=a):null};nb.prototype.any=function(a){var b=this.wb;b.Ma=null;var c=b.u;this.Va=-1;for(var d=b.j,e=d.length,f=this.sf,g=0;g<e;g++){var h=d[g];if(null===f||f(h)){if(a(h))return!0;b.u!==c&&Aa(b)}}return!1};
nb.prototype.all=function(a){var b=this.wb;b.Ma=null;var c=b.u;this.Va=-1;for(var d=b.j,e=d.length,f=this.sf,g=0;g<e;g++){var h=d[g];if(null===f||f(h)){if(!a(h))return!1;b.u!==c&&Aa(b)}}return!0};nb.prototype.each=function(a){var b=this.wb;b.Ma=null;var c=b.u;this.Va=-1;for(var d=b.j,e=d.length,f=this.sf,g=0;g<e;g++){var h=d[g];if(null===f||f(h))a(h),b.u!==c&&Aa(b)}return this};
nb.prototype.map=function(a){var b=this.wb;b.Ma=null;var c=b.u;this.Va=-1;for(var d=[],e=b.j,f=e.length,g=this.sf,h=0;h<f;h++){var k=e[h];if(null===g||g(k))d.push(a(k)),b.u!==c&&Aa(b)}a=new H;a.j=d;a.rb();return a.iterator};nb.prototype.filter=function(a){var b=this.wb;b.Ma=null;var c=b.u;this.Va=-1;for(var d=[],e=b.j,f=e.length,g=this.sf,h=0;h<f;h++){var k=e[h];if(null===g||g(k))a(k)&&d.push(k),b.u!==c&&Aa(b)}a=new H;a.j=d;a.rb();return a.iterator};
nb.prototype.Qd=function(){this.key=-1;this.value=null;this.oa=-1;this.sf=null;this.wb.Ma=this};nb.prototype.toString=function(){return"ListIterator@"+this.Va+"/"+this.wb.count};
ma.Object.defineProperties(nb.prototype,{iterator:{configurable:!0,get:function(){return this}},predicate:{configurable:!0,get:function(){return this.sf},set:function(a){this.sf=a}},count:{configurable:!0,get:function(){var a=this.sf;if(null!==a){for(var b=0,c=this.wb.j,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.wb.j.length}}});nb.prototype.first=nb.prototype.first;nb.prototype.hasNext=nb.prototype.rd;nb.prototype.next=nb.prototype.next;
nb.prototype.reset=nb.prototype.reset;nb.className="ListIterator";function ob(a){this.wb=a;a.rh=null;this.oa=a.u;this.Va=a.j.length}ob.prototype.reset=function(){var a=this.wb;a.rh=null;this.oa=a.u;this.Va=a.j.length};ob.prototype.next=function(){var a=this.wb;if(a.u!==this.oa){if(0>this.key)return!1;Aa(a)}var b=--this.Va;if(0<=b)return this.key=b,this.value=a.j[b],!0;this.Qd();return!1};ob.prototype.rd=function(){return this.next()};
ob.prototype.first=function(){var a=this.wb;this.oa=a.u;var b=a.j;this.Va=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};ob.prototype.any=function(a){var b=this.wb;b.rh=null;var c=b.u,d=b.j,e=d.length;this.Va=e;for(--e;0<=e;e--){if(a(d[e]))return!0;b.u!==c&&Aa(b)}return!1};ob.prototype.all=function(a){var b=this.wb;b.rh=null;var c=b.u,d=b.j,e=d.length;this.Va=e;for(--e;0<=e;e--){if(!a(d[e]))return!1;b.u!==c&&Aa(b)}return!0};
ob.prototype.each=function(a){var b=this.wb;b.rh=null;var c=b.u,d=b.j,e=d.length;this.Va=e;for(--e;0<=e;e--)a(d[e]),b.u!==c&&Aa(b);return this};ob.prototype.map=function(a){var b=this.wb;b.rh=null;var c=b.u,d=[],e=b.j,f=e.length;this.Va=f;for(--f;0<=f;f--)d.push(a(e[f])),b.u!==c&&Aa(b);a=new H;a.j=d;a.rb();return a.iterator};
ob.prototype.filter=function(a){var b=this.wb;b.rh=null;var c=b.u,d=[],e=b.j,f=e.length;this.Va=f;for(--f;0<=f;f--){var g=e[f];a(g)&&d.push(g);b.u!==c&&Aa(b)}a=new H;a.j=d;a.rb();return a.iterator};ob.prototype.Qd=function(){this.key=-1;this.value=null;this.oa=-1;this.wb.rh=this};ob.prototype.toString=function(){return"ListIteratorBackwards("+this.Va+"/"+this.wb.count+")"};
ma.Object.defineProperties(ob.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.wb.j.length}}});ob.prototype.first=ob.prototype.first;ob.prototype.hasNext=ob.prototype.rd;ob.prototype.next=ob.prototype.next;ob.prototype.reset=ob.prototype.reset;ob.className="ListIteratorBackwards";
function H(a){fb(this);this.s=!1;this.j=[];this.u=0;this.rh=this.Ma=null;void 0!==a&&("function"===typeof a||"string"===typeof a?Da():this.addAll(a))}t=H.prototype;t.rb=function(){var a=this.u;a++;999999999<a&&(a=0);this.u=a};t.freeze=function(){this.s=!0;return this};t.ka=function(){this.s=!1;return this};t.toString=function(){return"List()#"+pb(this)};t.add=function(a){if(null===a)return this;this.s&&va(this,a);this.j.push(a);this.rb();return this};t.push=function(a){this.add(a)};
t.addAll=function(a){if(null===a)return this;this.s&&va(this);var b=this.j;if(Ga(a))for(var c=a.length,d=0;d<c;d++)b.push(a[d]);else for(a=a.iterator;a.next();)b.push(a.value);this.rb();return this};t.clear=function(){this.s&&va(this);this.j.length=0;this.rb()};t.contains=function(a){return null===a?!1:-1!==this.j.indexOf(a)};t.has=function(a){return this.contains(a)};t.indexOf=function(a){return null===a?-1:this.j.indexOf(a)};
t.O=function(a){F&&C(a,H,"elt:i");var b=this.j;(0>a||a>=b.length)&&ya(a,"0 <= i < length",H,"elt:i");return b[a]};t.get=function(a){return this.O(a)};t.td=function(a,b){F&&C(a,H,"setElt:i");var c=this.j;(0>a||a>=c.length)&&ya(a,"0 <= i < length",H,"setElt:i");this.s&&va(this,a);c[a]=b};t.set=function(a,b){this.td(a,b)};t.first=function(){var a=this.j;return 0===a.length?null:a[0]};t.cc=function(){var a=this.j,b=a.length;return 0<b?a[b-1]:null};
t.pop=function(){this.s&&va(this);var a=this.j;return 0<a.length?a.pop():null};H.prototype.any=function(a){for(var b=this.j,c=this.u,d=b.length,e=0;e<d;e++){if(a(b[e]))return!0;this.u!==c&&Aa(this)}return!1};H.prototype.all=function(a){for(var b=this.j,c=this.u,d=b.length,e=0;e<d;e++){if(!a(b[e]))return!1;this.u!==c&&Aa(this)}return!0};H.prototype.each=function(a){for(var b=this.j,c=this.u,d=b.length,e=0;e<d;e++)a(b[e]),this.u!==c&&Aa(this);return this};
H.prototype.map=function(a){for(var b=new H,c=[],d=this.j,e=this.u,f=d.length,g=0;g<f;g++)c.push(a(d[g])),this.u!==e&&Aa(this);b.j=c;b.rb();return b};H.prototype.filter=function(a){for(var b=new H,c=[],d=this.j,e=this.u,f=d.length,g=0;g<f;g++){var h=d[g];a(h)&&c.push(h);this.u!==e&&Aa(this)}b.j=c;b.rb();return b};t=H.prototype;t.Ab=function(a,b){F&&C(a,H,"insertAt:i");0>a&&ya(a,">= 0",H,"insertAt:i");this.s&&va(this,a);var c=this.j;a>=c.length?c.push(b):c.splice(a,0,b);this.rb()};
t.remove=function(a){if(null===a)return!1;this.s&&va(this,a);var b=this.j;a=b.indexOf(a);if(-1===a)return!1;a===b.length-1?b.pop():b.splice(a,1);this.rb();return!0};t.delete=function(a){return this.remove(a)};t.ib=function(a){F&&C(a,H,"removeAt:i");var b=this.j;(0>a||a>=b.length)&&ya(a,"0 <= i < length",H,"removeAt:i");this.s&&va(this,a);a===b.length-1?b.pop():b.splice(a,1);this.rb()};
t.removeRange=function(a,b){F&&(C(a,H,"removeRange:from"),C(b,H,"removeRange:to"));var c=this.j,d=c.length;if(0>a)a=0;else if(a>=d)return this;if(0>b)return this;b>=d&&(b=d-1);if(a>b)return this;this.s&&va(this);for(var e=a,f=b+1;f<d;)c[e++]=c[f++];c.length=d-(b-a+1);this.rb();return this};H.prototype.copy=function(){var a=new H,b=this.j;0<b.length&&(a.j=Array.prototype.slice.call(b));return a};t=H.prototype;t.ta=function(){for(var a=this.j,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c};
t.Yw=function(){for(var a=new I,b=this.j,c=this.count,d=0;d<c;d++)a.add(b[d]);return a};t.sort=function(a){F&&A(a,"function",H,"sort:sortfunc");this.s&&va(this);this.j.sort(a);this.rb();return this};
t.Fj=function(a,b,c){var d=this.j,e=d.length;void 0===b&&(b=0);void 0===c&&(c=e);F&&(A(a,"function",H,"sortRange:sortfunc"),C(b,H,"sortRange:from"),C(c,H,"sortRange:to"));this.s&&va(this);var f=c-b;if(1>=f)return this;(0>b||b>=e-1)&&ya(b,"0 <= from < length",H,"sortRange:from");if(2===f)return c=d[b],e=d[b+1],0<a(c,e)&&(d[b]=e,d[b+1]=c,this.rb()),this;if(0===b)if(c>=e)d.sort(a);else for(b=d.slice(0,c),b.sort(a),a=0;a<c;a++)d[a]=b[a];else if(c>=e)for(c=d.slice(b),c.sort(a),a=b;a<e;a++)d[a]=c[a-b];
else for(e=d.slice(b,c),e.sort(a),a=b;a<c;a++)d[a]=e[a-b];this.rb();return this};t.reverse=function(){this.s&&va(this);this.j.reverse();this.rb();return this};
ma.Object.defineProperties(H.prototype,{_dataArray:{configurable:!0,get:function(){return this.j}},count:{configurable:!0,get:function(){return this.j.length}},size:{configurable:!0,get:function(){return this.j.length}},length:{configurable:!0,get:function(){return this.j.length}},iterator:{configurable:!0,get:function(){if(0>=this.j.length)return lb;var a=this.Ma;return null!==a?(a.reset(),a):new nb(this)}},iteratorBackwards:{configurable:!0,
enumerable:!0,get:function(){if(0>=this.j.length)return lb;var a=this.rh;return null!==a?(a.reset(),a):new ob(this)}}});H.prototype.reverse=H.prototype.reverse;H.prototype.sortRange=H.prototype.Fj;H.prototype.sort=H.prototype.sort;H.prototype.toSet=H.prototype.Yw;H.prototype.toArray=H.prototype.ta;H.prototype.removeRange=H.prototype.removeRange;H.prototype.removeAt=H.prototype.ib;H.prototype["delete"]=H.prototype.delete;H.prototype.remove=H.prototype.remove;H.prototype.insertAt=H.prototype.Ab;
H.prototype.pop=H.prototype.pop;H.prototype.last=H.prototype.cc;H.prototype.first=H.prototype.first;H.prototype.set=H.prototype.set;H.prototype.setElt=H.prototype.td;H.prototype.get=H.prototype.get;H.prototype.elt=H.prototype.O;H.prototype.indexOf=H.prototype.indexOf;H.prototype.has=H.prototype.has;H.prototype.contains=H.prototype.contains;H.prototype.clear=H.prototype.clear;H.prototype.addAll=H.prototype.addAll;H.prototype.push=H.prototype.push;H.prototype.add=H.prototype.add;H.prototype.thaw=H.prototype.ka;
H.prototype.freeze=H.prototype.freeze;H.className="List";function tb(a){this.Fg=a;a.Ma=null;this.oa=a.u;this.qa=null}tb.prototype.reset=function(){var a=this.Fg;a.Ma=null;this.oa=a.u;this.qa=null};tb.prototype.next=function(){var a=this.Fg;if(a.u!==this.oa){if(null===this.key)return!1;Aa(a)}var b=this.qa;b=null===b?a.ga:b.va;if(null!==b)return this.qa=b,this.value=b.value,this.key=b.key,!0;this.Qd();return!1};tb.prototype.rd=function(){return this.next()};
tb.prototype.first=function(){var a=this.Fg;this.oa=a.u;a=a.ga;if(null!==a){this.qa=a;var b=a.value;this.key=a.key;return this.value=b}return null};tb.prototype.any=function(a){var b=this.Fg;b.Ma=null;var c=b.u;this.qa=null;for(var d=b.ga;null!==d;){if(a(d.value))return!0;b.u!==c&&Aa(b);d=d.va}return!1};tb.prototype.all=function(a){var b=this.Fg;b.Ma=null;var c=b.u;this.qa=null;for(var d=b.ga;null!==d;){if(!a(d.value))return!1;b.u!==c&&Aa(b);d=d.va}return!0};
tb.prototype.each=function(a){var b=this.Fg;b.Ma=null;var c=b.u;this.qa=null;for(var d=b.ga;null!==d;)a(d.value),b.u!==c&&Aa(b),d=d.va;return this};tb.prototype.map=function(a){var b=this.Fg;b.Ma=null;for(var c=new H,d=b.u,e=b.ga;null!==e;)c.add(a(e.value)),b.u!==d&&Aa(b),e=e.va;return c.iterator};tb.prototype.filter=function(a){var b=this.Fg;b.Ma=null;for(var c=new H,d=b.u,e=b.ga;null!==e;){var f=e.value;a(f)&&c.add(f);b.u!==d&&Aa(b);e=e.va}return c.iterator};
tb.prototype.Qd=function(){this.value=this.key=null;this.oa=-1;this.Fg.Ma=this};tb.prototype.toString=function(){return null!==this.qa?"SetIterator@"+this.qa.value:"SetIterator"};ma.Object.defineProperties(tb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.Fg.Lb}}});tb.prototype.first=tb.prototype.first;tb.prototype.hasNext=tb.prototype.rd;tb.prototype.next=tb.prototype.next;tb.prototype.reset=tb.prototype.reset;
tb.className="SetIterator";function I(a){fb(this);this.s=!1;this.Nb={};this.Lb=0;this.Ma=null;this.u=0;this.lf=this.ga=null;void 0!==a&&("function"===typeof a||"string"===typeof a?Da():this.addAll(a))}t=I.prototype;t.rb=function(){var a=this.u;a++;999999999<a&&(a=0);this.u=a};t.freeze=function(){this.s=!0;return this};t.ka=function(){this.s=!1;return this};t.toString=function(){return"Set()#"+pb(this)};
t.add=function(a){if(null===a)return this;this.s&&va(this,a);var b=a;Fa(a)&&(b=ub(a));void 0===this.Nb[b]&&(this.Lb++,a=new vb(a,a),this.Nb[b]=a,b=this.lf,null===b?this.ga=a:(a.cm=b,b.va=a),this.lf=a,this.rb());return this};t.addAll=function(a){if(null===a)return this;this.s&&va(this);if(Ga(a))for(var b=a.length,c=0;c<b;c++)this.add(a[c]);else for(a=a.iterator;a.next();)this.add(a.value);return this};
t.contains=function(a){if(null===a)return!1;var b=a;return Fa(a)&&(b=pb(a),void 0===b)?!1:void 0!==this.Nb[b]};t.has=function(a){return this.contains(a)};t.Qz=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.Rz=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(this.contains(a.value))return!0;return!1};t.first=function(){var a=this.ga;return null===a?null:a.value};
I.prototype.any=function(a){for(var b=this.u,c=this.ga;null!==c;){if(a(c.value))return!0;this.u!==b&&Aa(this);c=c.va}return!1};I.prototype.all=function(a){for(var b=this.u,c=this.ga;null!==c;){if(!a(c.value))return!1;this.u!==b&&Aa(this);c=c.va}return!0};I.prototype.each=function(a){for(var b=this.u,c=this.ga;null!==c;)a(c.value),this.u!==b&&Aa(this),c=c.va;return this};I.prototype.map=function(a){for(var b=new I,c=this.u,d=this.ga;null!==d;)b.add(a(d.value)),this.u!==c&&Aa(this),d=d.va;return b};
I.prototype.filter=function(a){for(var b=new I,c=this.u,d=this.ga;null!==d;){var e=d.value;a(e)&&b.add(e);this.u!==c&&Aa(this);d=d.va}return b};t=I.prototype;t.remove=function(a){if(null===a)return!1;this.s&&va(this,a);var b=a;if(Fa(a)&&(b=pb(a),void 0===b))return!1;a=this.Nb[b];if(void 0===a)return!1;var c=a.va,d=a.cm;null!==c&&(c.cm=d);null!==d&&(d.va=c);this.ga===a&&(this.ga=c);this.lf===a&&(this.lf=d);delete this.Nb[b];this.Lb--;this.rb();return!0};t.delete=function(a){return this.remove(a)};
t.nr=function(a){if(null===a)return this;this.s&&va(this);if(Ga(a))for(var b=a.length,c=0;c<b;c++)this.remove(a[c]);else for(a=a.iterator;a.next();)this.remove(a.value);return this};t.kB=function(a){if(null===a||0===this.count)return this;this.s&&va(this);var b=new I;b.addAll(a);a=[];for(var c=this.iterator;c.next();){var d=c.value;b.contains(d)||a.push(d)}this.nr(a);return this};t.clear=function(){this.s&&va(this);this.Nb={};this.Lb=0;null!==this.Ma&&this.Ma.reset();this.lf=this.ga=null;this.rb()};
I.prototype.copy=function(){var a=new I,b=this.Nb,c;for(c in b)a.add(b[c].value);return a};I.prototype.ta=function(){var a=Array(this.Lb),b=this.Nb,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};I.prototype.Xw=function(){var a=new H,b=this.Nb,c;for(c in b)a.add(b[c].value);return a};function fb(a){a.__gohashid=wb++}function ub(a){var b=a.__gohashid;void 0===b&&(b=wb++,a.__gohashid=b);return b}function pb(a){return a.__gohashid}
ma.Object.defineProperties(I.prototype,{count:{configurable:!0,get:function(){return this.Lb}},size:{configurable:!0,get:function(){return this.Lb}},iterator:{configurable:!0,get:function(){if(0>=this.Lb)return lb;var a=this.Ma;return null!==a?(a.reset(),a):new tb(this)}}});I.prototype.toList=I.prototype.Xw;I.prototype.toArray=I.prototype.ta;I.prototype.clear=I.prototype.clear;I.prototype.retainAll=I.prototype.kB;I.prototype.removeAll=I.prototype.nr;
I.prototype["delete"]=I.prototype.delete;I.prototype.remove=I.prototype.remove;I.prototype.first=I.prototype.first;I.prototype.containsAny=I.prototype.Rz;I.prototype.containsAll=I.prototype.Qz;I.prototype.has=I.prototype.has;I.prototype.contains=I.prototype.contains;I.prototype.addAll=I.prototype.addAll;I.prototype.add=I.prototype.add;I.prototype.thaw=I.prototype.ka;I.prototype.freeze=I.prototype.freeze;var wb=1;I.className="Set";I.uniqueHash=fb;I.hashIdUnique=ub;I.hashId=pb;
function xb(a){this.la=a;this.oa=a.u;this.qa=null}xb.prototype.reset=function(){this.oa=this.la.u;this.qa=null};xb.prototype.next=function(){var a=this.la;if(a.u!==this.oa){if(null===this.key)return!1;Aa(a)}var b=this.qa;b=null===b?a.ga:b.va;if(null!==b)return this.qa=b,this.value=this.key=a=b.key,!0;this.Qd();return!1};xb.prototype.rd=function(){return this.next()};xb.prototype.first=function(){var a=this.la;this.oa=a.u;a=a.ga;return null!==a?(this.qa=a,this.value=this.key=a=a.key):null};
xb.prototype.any=function(a){var b=this.la,c=b.u;this.qa=null;for(var d=b.ga;null!==d;){if(a(d.key))return!0;b.u!==c&&Aa(b);d=d.va}return!1};xb.prototype.all=function(a){var b=this.la,c=b.u;this.qa=null;for(var d=b.ga;null!==d;){if(!a(d.key))return!1;b.u!==c&&Aa(b);d=d.va}return!0};xb.prototype.each=function(a){var b=this.la,c=b.u;this.qa=null;for(var d=b.ga;null!==d;)a(d.key),b.u!==c&&Aa(b),d=d.va;return this};
xb.prototype.map=function(a){var b=this.la,c=b.u;this.qa=null;for(var d=new H,e=b.ga;null!==e;)d.add(a(e.key)),b.u!==c&&Aa(b),e=e.va;return d.iterator};xb.prototype.filter=function(a){var b=this.la,c=b.u;this.qa=null;for(var d=new H,e=b.ga;null!==e;){var f=e.key;a(f)&&d.add(f);b.u!==c&&Aa(b);e=e.va}return d.iterator};xb.prototype.Qd=function(){this.value=this.key=null;this.oa=-1};xb.prototype.toString=function(){return null!==this.qa?"MapKeySetIterator@"+this.qa.value:"MapKeySetIterator"};
ma.Object.defineProperties(xb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.la.Lb}}});xb.prototype.first=xb.prototype.first;xb.prototype.hasNext=xb.prototype.rd;xb.prototype.next=xb.prototype.next;xb.prototype.reset=xb.prototype.reset;xb.className="MapKeySetIterator";function Ab(a){I.call(this);fb(this);this.s=!0;this.la=a}la(Ab,I);t=Ab.prototype;t.freeze=function(){return this};t.ka=function(){return this};
t.toString=function(){return"MapKeySet("+this.la.toString()+")"};t.add=function(){v("This Set is read-only: "+this.toString());return this};t.contains=function(a){return this.la.contains(a)};t.has=function(a){return this.contains(a)};t.remove=function(){v("This Set is read-only: "+this.toString());return!1};t.delete=function(a){return this.remove(a)};t.clear=function(){v("This Set is read-only: "+this.toString())};t.first=function(){var a=this.la.ga;return null!==a?a.key:null};
Ab.prototype.any=function(a){for(var b=this.la.ga;null!==b;){if(a(b.key))return!0;b=b.va}return!1};Ab.prototype.all=function(a){for(var b=this.la.ga;null!==b;){if(!a(b.key))return!1;b=b.va}return!0};Ab.prototype.each=function(a){for(var b=this.la.ga;null!==b;)a(b.key),b=b.va;return this};Ab.prototype.map=function(a){for(var b=new I,c=this.la.ga;null!==c;)b.add(a(c.key)),c=c.va;return b};Ab.prototype.filter=function(a){for(var b=new I,c=this.la.ga;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.va}return b};
Ab.prototype.copy=function(){return new Ab(this.la)};Ab.prototype.Yw=function(){var a=new I,b=this.la.Nb,c;for(c in b)a.add(b[c].key);return a};Ab.prototype.ta=function(){var a=this.la.Nb,b=Array(this.la.Lb),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};Ab.prototype.Xw=function(){var a=new H,b=this.la.Nb,c;for(c in b)a.add(b[c].key);return a};
ma.Object.defineProperties(Ab.prototype,{count:{configurable:!0,get:function(){return this.la.Lb}},size:{configurable:!0,get:function(){return this.la.Lb}},iterator:{configurable:!0,get:function(){return 0>=this.la.Lb?lb:new xb(this.la)}}});Ab.prototype.toList=Ab.prototype.Xw;Ab.prototype.toArray=Ab.prototype.ta;Ab.prototype.toSet=Ab.prototype.Yw;Ab.prototype.first=Ab.prototype.first;Ab.prototype.clear=Ab.prototype.clear;Ab.prototype["delete"]=Ab.prototype.delete;
Ab.prototype.remove=Ab.prototype.remove;Ab.prototype.has=Ab.prototype.has;Ab.prototype.contains=Ab.prototype.contains;Ab.prototype.add=Ab.prototype.add;Ab.prototype.thaw=Ab.prototype.ka;Ab.prototype.freeze=Ab.prototype.freeze;Ab.className="MapKeySet";function Bb(a){this.la=a;a.kf=null;this.oa=a.u;this.qa=null}Bb.prototype.reset=function(){var a=this.la;a.kf=null;this.oa=a.u;this.qa=null};
Bb.prototype.next=function(){var a=this.la;if(a.u!==this.oa){if(null===this.key)return!1;Aa(a)}var b=this.qa;b=null===b?a.ga:b.va;if(null!==b)return this.qa=b,this.value=b.value,this.key=b.key,!0;this.Qd();return!1};Bb.prototype.rd=function(){return this.next()};Bb.prototype.first=function(){var a=this.la;this.oa=a.u;a=a.ga;if(null!==a){this.qa=a;var b=a.value;this.key=a.key;return this.value=b}return null};
Bb.prototype.any=function(a){var b=this.la;b.kf=null;var c=b.u;this.qa=null;for(var d=b.ga;null!==d;){if(a(d.value))return!0;b.u!==c&&Aa(b);d=d.va}return!1};Bb.prototype.all=function(a){var b=this.la;b.kf=null;var c=b.u;this.qa=null;for(var d=b.ga;null!==d;){if(!a(d.value))return!1;b.u!==c&&Aa(b);d=d.va}return!0};Bb.prototype.each=function(a){var b=this.la;b.kf=null;var c=b.u;this.qa=null;for(var d=b.ga;null!==d;)a(d.value),b.u!==c&&Aa(b),d=d.va;return this};
Bb.prototype.map=function(a){var b=this.la;b.kf=null;var c=b.u;this.qa=null;for(var d=new H,e=b.ga;null!==e;)d.add(a(e.value)),b.u!==c&&Aa(b),e=e.va;return d.iterator};Bb.prototype.filter=function(a){var b=this.la;b.kf=null;var c=b.u;this.qa=null;for(var d=new H,e=b.ga;null!==e;){var f=e.value;a(f)&&d.add(f);b.u!==c&&Aa(b);e=e.va}return d.iterator};Bb.prototype.Qd=function(){this.value=this.key=null;this.oa=-1;this.la.kf=this};
Bb.prototype.toString=function(){return null!==this.qa?"MapValueSetIterator@"+this.qa.value:"MapValueSetIterator"};ma.Object.defineProperties(Bb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.la.Lb}}});Bb.prototype.first=Bb.prototype.first;Bb.prototype.hasNext=Bb.prototype.rd;Bb.prototype.next=Bb.prototype.next;Bb.prototype.reset=Bb.prototype.reset;Bb.className="MapValueSetIterator";
function vb(a,b){this.key=a;this.value=b;this.cm=this.va=null}vb.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};vb.className="KeyValuePair";function Cb(a){this.la=a;a.Ma=null;this.oa=a.u;this.qa=null}Cb.prototype.reset=function(){var a=this.la;a.Ma=null;this.oa=a.u;this.qa=null};
Cb.prototype.next=function(){var a=this.la;if(a.u!==this.oa){if(null===this.key)return!1;Aa(a)}var b=this.qa;b=null===b?a.ga:b.va;if(null!==b)return this.qa=b,this.key=b.key,this.value=b.value,!0;this.Qd();return!1};Cb.prototype.rd=function(){return this.next()};Cb.prototype.first=function(){var a=this.la;this.oa=a.u;a=a.ga;return null!==a?(this.qa=a,this.key=a.key,this.value=a.value,a):null};
Cb.prototype.any=function(a){var b=this.la;b.Ma=null;var c=b.u;this.qa=null;for(var d=b.ga;null!==d;){if(a(d))return!0;b.u!==c&&Aa(b);d=d.va}return!1};Cb.prototype.all=function(a){var b=this.la;b.Ma=null;var c=b.u;this.qa=null;for(var d=b.ga;null!==d;){if(!a(d))return!1;b.u!==c&&Aa(b);d=d.va}return!0};Cb.prototype.each=function(a){var b=this.la;b.Ma=null;var c=b.u;this.qa=null;for(var d=b.ga;null!==d;)a(d),b.u!==c&&Aa(b),d=d.va;return this};
Cb.prototype.map=function(a){var b=this.la;b.Ma=null;var c=b.u;this.qa=null;for(var d=new H,e=b.ga;null!==e;)d.add(a(e)),b.u!==c&&Aa(b),e=e.va;return d.iterator};Cb.prototype.filter=function(a){var b=this.la;b.Ma=null;var c=b.u;this.qa=null;for(var d=new H,e=b.ga;null!==e;)a(e)&&d.add(e),b.u!==c&&Aa(b),e=e.va;return d.iterator};Cb.prototype.Qd=function(){this.value=this.key=null;this.oa=-1;this.la.Ma=this};Cb.prototype.toString=function(){return null!==this.qa?"MapIterator@"+this.qa:"MapIterator"};
ma.Object.defineProperties(Cb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.la.Lb}}});Cb.prototype.first=Cb.prototype.first;Cb.prototype.hasNext=Cb.prototype.rd;Cb.prototype.next=Cb.prototype.next;Cb.prototype.reset=Cb.prototype.reset;Cb.className="MapIterator";
function Db(a){fb(this);this.s=!1;this.Nb={};this.Lb=0;this.kf=this.Ma=null;this.u=0;this.lf=this.ga=null;void 0!==a&&("function"===typeof a||"string"===typeof a?Da():this.addAll(a))}t=Db.prototype;t.rb=function(){var a=this.u;a++;999999999<a&&(a=0);this.u=a};t.freeze=function(){this.s=!0;return this};t.ka=function(){this.s=!1;return this};t.toString=function(){return"Map()#"+pb(this)};
t.add=function(a,b){this.s&&va(this,a);var c=a;Fa(a)&&(c=ub(a));var d=this.Nb[c];void 0===d?(this.Lb++,a=new vb(a,b),this.Nb[c]=a,c=this.lf,null===c?this.ga=a:(a.cm=c,c.va=a),this.lf=a,this.rb()):d.value=b;return this};t.set=function(a,b){return this.add(a,b)};
t.addAll=function(a){if(null===a)return this;if(Ga(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];this.add(d.key,d.value)}else if(a instanceof Db)for(a=a.iterator;a.next();)this.add(a.key,a.value);else for(a=a.iterator;a.next();)b=a.value,this.add(b.key,b.value);return this};t.first=function(){return this.ga};Db.prototype.any=function(a){for(var b=this.u,c=this.ga;null!==c;){if(a(c))return!0;this.u!==b&&Aa(this);c=c.va}return!1};
Db.prototype.all=function(a){for(var b=this.u,c=this.ga;null!==c;){if(!a(c))return!1;this.u!==b&&Aa(this);c=c.va}return!0};Db.prototype.each=function(a){for(var b=this.u,c=this.ga;null!==c;)a(c),this.u!==b&&Aa(this),c=c.va;return this};Db.prototype.map=function(a){for(var b=new Db,c=this.u,d=this.ga;null!==d;)b.add(d.key,a(d)),this.u!==c&&Aa(this),d=d.va;return b};Db.prototype.filter=function(a){for(var b=new Db,c=this.u,d=this.ga;null!==d;)a(d)&&b.add(d.key,d.value),this.u!==c&&Aa(this),d=d.va;return b};
t=Db.prototype;t.contains=function(a){var b=a;return Fa(a)&&(b=pb(a),void 0===b)?!1:void 0!==this.Nb[b]};t.has=function(a){return this.contains(a)};t.K=function(a){var b=a;if(Fa(a)&&(b=pb(a),void 0===b))return null;a=this.Nb[b];return void 0===a?null:a.value};t.get=function(a){return this.K(a)};
t.remove=function(a){if(null===a)return!1;this.s&&va(this,a);var b=a;if(Fa(a)&&(b=pb(a),void 0===b))return!1;a=this.Nb[b];if(void 0===a)return!1;var c=a.va,d=a.cm;null!==c&&(c.cm=d);null!==d&&(d.va=c);this.ga===a&&(this.ga=c);this.lf===a&&(this.lf=d);delete this.Nb[b];this.Lb--;this.rb();return!0};t.delete=function(a){return this.remove(a)};t.clear=function(){this.s&&va(this);this.Nb={};this.Lb=0;null!==this.Ma&&this.Ma.reset();null!==this.kf&&this.kf.reset();this.lf=this.ga=null;this.rb()};
Db.prototype.copy=function(){var a=new Db,b=this.Nb,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};Db.prototype.ta=function(){var a=this.Nb,b=Array(this.Lb),c=0,d;for(d in a){var e=a[d];b[c]=new vb(e.key,e.value);c++}return b};Db.prototype.Vf=function(){return new Ab(this)};
ma.Object.defineProperties(Db.prototype,{count:{configurable:!0,get:function(){return this.Lb}},size:{configurable:!0,get:function(){return this.Lb}},iterator:{configurable:!0,get:function(){if(0>=this.count)return lb;var a=this.Ma;return null!==a?(a.reset(),a):new Cb(this)}},iteratorKeys:{configurable:!0,get:function(){return 0>=this.count?lb:new xb(this)}},iteratorValues:{configurable:!0,get:function(){if(0>=this.count)return lb;
var a=this.kf;return null!==a?(a.reset(),a):new Bb(this)}}});Db.prototype.toKeySet=Db.prototype.Vf;Db.prototype.toArray=Db.prototype.ta;Db.prototype.clear=Db.prototype.clear;Db.prototype["delete"]=Db.prototype.delete;Db.prototype.remove=Db.prototype.remove;Db.prototype.get=Db.prototype.get;Db.prototype.getValue=Db.prototype.K;Db.prototype.has=Db.prototype.has;Db.prototype.contains=Db.prototype.contains;Db.prototype.first=Db.prototype.first;Db.prototype.addAll=Db.prototype.addAll;
Db.prototype.set=Db.prototype.set;Db.prototype.add=Db.prototype.add;Db.prototype.thaw=Db.prototype.ka;Db.prototype.freeze=Db.prototype.freeze;Db.className="Map";function J(a,b){void 0===a?this.H=this.G=0:"number"===typeof a&&"number"===typeof b?(this.G=a,this.H=b):v("Invalid arguments to Point constructor: "+a+", "+b);this.s=!1}J.prototype.assign=function(a){this.G=a.G;this.H=a.H;return this};J.prototype.h=function(a,b){this.G=a;this.H=b;return this};
J.prototype.Ug=function(a,b){F&&(A(a,"number",J,"setTo:x"),A(b,"number",J,"setTo:y"),this.ha());this.G=a;this.H=b;return this};J.prototype.set=function(a){F&&(x(a,J,J,"set:p"),this.ha());this.G=a.G;this.H=a.H;return this};J.prototype.copy=function(){var a=new J;a.G=this.G;a.H=this.H;return a};t=J.prototype;t.ia=function(){this.s=!0;Object.freeze(this);return this};t.J=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};
t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;return this};t.ha=function(a){if(F&&this.s){var b="The Point is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};function Eb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new J(c,e)}return new J}
function Fb(a){F&&x(a,J);return a.x.toString()+" "+a.y.toString()}t.toString=function(){return"Point("+this.x+","+this.y+")"};t.A=function(a){return a instanceof J?this.G===a.x&&this.H===a.y:!1};t.qj=function(a,b){return this.G===a&&this.H===b};t.Ta=function(a){return K.C(this.G,a.x)&&K.C(this.H,a.y)};t.add=function(a){F&&(x(a,J,J,"add:p"),this.ha());this.G+=a.x;this.H+=a.y;return this};t.ke=function(a){F&&(x(a,J,J,"subtract:p"),this.ha());this.G-=a.x;this.H-=a.y;return this};
t.offset=function(a,b){F&&(C(a,J,"offset:dx"),C(b,J,"offset:dy"),this.ha());this.G+=a;this.H+=b;return this};J.prototype.rotate=function(a){F&&(C(a,J,"rotate:angle"),this.ha());if(0===a)return this;var b=this.G,c=this.H;if(0===b&&0===c)return this;360<=a?a-=360:0>a&&(a+=360);if(90===a){a=0;var d=1}else 180===a?(a=-1,d=0):270===a?(a=0,d=-1):(d=a*Math.PI/180,a=Math.cos(d),d=Math.sin(d));this.G=a*b-d*c;this.H=d*b+a*c;return this};t=J.prototype;
t.scale=function(a,b){F&&(C(a,J,"scale:sx"),C(b,J,"scale:sy"),this.ha());this.G*=a;this.H*=b;return this};t.Se=function(a){F&&x(a,J,J,"distanceSquaredPoint:p");var b=a.x-this.G;a=a.y-this.H;return b*b+a*a};t.qd=function(a,b){F&&(C(a,J,"distanceSquared:px"),C(b,J,"distanceSquared:py"));a-=this.G;b-=this.H;return a*a+b*b};t.normalize=function(){F&&this.ha();var a=this.G,b=this.H,c=Math.sqrt(a*a+b*b);0<c&&(this.G=a/c,this.H=b/c);return this};
t.Xa=function(a){F&&x(a,J,J,"directionPoint:p");return Gb(a.x-this.G,a.y-this.H)};t.direction=function(a,b){F&&(C(a,J,"direction:px"),C(b,J,"direction:py"));return Gb(a-this.G,b-this.H)};function Gb(a,b){if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;var c=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?c=0>b?c+180:180-c:0>b&&(c=360-c);return c}
t.dB=function(a,b,c,d){F&&(C(a,J,"projectOntoLineSegment:px"),C(b,J,"projectOntoLineSegment:py"),C(c,J,"projectOntoLineSegment:qx"),C(d,J,"projectOntoLineSegment:qy"));K.ai(a,b,c,d,this.G,this.H,this);return this};t.eB=function(a,b){F&&(x(a,J,J,"projectOntoLineSegmentPoint:p"),x(b,J,J,"projectOntoLineSegmentPoint:q"));K.ai(a.x,a.y,b.x,b.y,this.G,this.H,this);return this};
t.pB=function(a,b,c,d){F&&(C(a,J,"snapToGrid:originx"),C(b,J,"snapToGrid:originy"),C(c,J,"snapToGrid:cellwidth"),C(d,J,"snapToGrid:cellheight"));K.Rq(this.G,this.H,a,b,c,d,this);return this};t.qB=function(a,b){F&&(x(a,J,J,"snapToGridPoint:p"),x(b,Hb,J,"snapToGridPoint:q"));K.Rq(this.G,this.H,a.x,a.y,b.width,b.height,this);return this};t.Ej=function(a,b){F&&(x(a,L,J,"setRectSpot:r"),x(b,M,J,"setRectSpot:spot"),this.ha());this.G=a.x+b.x*a.width+b.offsetX;this.H=a.y+b.y*a.height+b.offsetY;return this};
t.Wk=function(a,b,c,d,e){F&&(C(a,J,"setSpot:x"),C(b,J,"setSpot:y"),C(c,J,"setSpot:w"),C(d,J,"setSpot:h"),(0>c||0>d)&&v("Point.setSpot:Width and height cannot be negative"),x(e,M,J,"setSpot:spot"),this.ha());this.G=a+e.x*c+e.offsetX;this.H=b+e.y*d+e.offsetY;return this};t.transform=function(a){F&&x(a,Ib,J,"transform:t");a.ya(this);return this};function Jb(a,b){F&&x(b,Ib,J,"transformInverted:t");b.ge(a);return a}
function Kb(a,b,c,d,e,f){F&&(C(a,J,"distanceLineSegmentSquared:px"),C(b,J,"distanceLineSegmentSquared:py"),C(c,J,"distanceLineSegmentSquared:ax"),C(d,J,"distanceLineSegmentSquared:ay"),C(e,J,"distanceLineSegmentSquared:bx"),C(f,J,"distanceLineSegmentSquared:by"));var g=e-c,h=f-d,k=g*g+h*h;c-=a;d-=b;var l=-c*g-d*h;if(0>=l||l>=k)return g=e-a,h=f-b,Math.min(c*c+d*d,g*g+h*h);a=g*d-h*c;return a*a/k}
function Lb(a,b,c,d){F&&(C(a,J,"distanceSquared:px"),C(b,J,"distanceSquared:py"),C(c,J,"distanceSquared:qx"),C(d,J,"distanceSquared:qy"));a=c-a;b=d-b;return a*a+b*b}function Mb(a,b,c,d){F&&(C(a,J,"direction:px"),C(b,J,"direction:py"),C(c,J,"direction:qx"),C(d,J,"direction:qy"));a=c-a;b=d-b;if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;d=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?d=0>b?d+180:180-d:0>b&&(d=360-d);return d}
t.o=function(){return isFinite(this.x)&&isFinite(this.y)};J.alloc=function(){var a=Nb.pop();return void 0===a?new J:a};J.allocAt=function(a,b){var c=Nb.pop();if(void 0===c)return new J(a,b);c.x=a;c.y=b;return c};J.free=function(a){Nb.push(a)};
ma.Object.defineProperties(J.prototype,{x:{configurable:!0,get:function(){return this.G},set:function(a){F&&(A(a,"number",J,"x"),this.ha(a));this.G=a}},y:{configurable:!0,get:function(){return this.H},set:function(a){F&&(A(a,"number",J,"y"),this.ha(a));this.H=a}}});J.prototype.isReal=J.prototype.o;J.prototype.setSpot=J.prototype.Wk;J.prototype.setRectSpot=J.prototype.Ej;J.prototype.snapToGridPoint=J.prototype.qB;J.prototype.snapToGrid=J.prototype.pB;
J.prototype.projectOntoLineSegmentPoint=J.prototype.eB;J.prototype.projectOntoLineSegment=J.prototype.dB;J.intersectingLineSegments=function(a,b,c,d,e,f,g,h){F&&(C(a,L,"intersectingLineSegments:a1x"),C(b,L,"intersectingLineSegments:a1y"),C(c,L,"intersectingLineSegments:a2x"),C(d,L,"intersectingLineSegments:a2y"),C(e,L,"intersectingLineSegments:b1x"),C(f,L,"intersectingLineSegments:b1y"),C(g,L,"intersectingLineSegments:b2x"),C(h,L,"intersectingLineSegments:b2y"));return K.Zq(a,b,c,d,e,f,g,h)};
J.prototype.direction=J.prototype.direction;J.prototype.directionPoint=J.prototype.Xa;J.prototype.normalize=J.prototype.normalize;J.prototype.distanceSquared=J.prototype.qd;J.prototype.distanceSquaredPoint=J.prototype.Se;J.prototype.scale=J.prototype.scale;J.prototype.rotate=J.prototype.rotate;J.prototype.offset=J.prototype.offset;J.prototype.subtract=J.prototype.ke;J.prototype.add=J.prototype.add;J.prototype.equalsApprox=J.prototype.Ta;J.prototype.equalTo=J.prototype.qj;J.prototype.equals=J.prototype.A;
J.prototype.set=J.prototype.set;J.prototype.setTo=J.prototype.Ug;var Ob=null,Sb=null,Tb=null,Ub=null,Vb=null,Nb=[];J.className="Point";J.parse=Eb;J.stringify=Fb;J.distanceLineSegmentSquared=Kb;J.distanceSquared=Lb;J.direction=Mb;J.Origin=Ob=(new J(0,0)).ia();J.InfiniteTopLeft=Sb=(new J(-Infinity,-Infinity)).ia();J.InfiniteBottomRight=Tb=(new J(Infinity,Infinity)).ia();J.SixPoint=Ub=(new J(6,6)).ia();J.NoPoint=Vb=(new J(NaN,NaN)).ia();J.parse=Eb;J.stringify=Fb;J.distanceLineSegmentSquared=Kb;
J.distanceSquared=Lb;J.direction=Mb;function Hb(a,b){void 0===a?this.da=this.ea=0:"number"===typeof a&&(0<=a||isNaN(a))&&"number"===typeof b&&(0<=b||isNaN(b))?(this.ea=a,this.da=b):v("Invalid arguments to Size constructor: "+a+", "+b);this.s=!1}var Wb,Xb,Yb,$b,ac,bc,cc;Hb.prototype.assign=function(a){this.ea=a.ea;this.da=a.da;return this};Hb.prototype.h=function(a,b){this.ea=a;this.da=b;return this};
Hb.prototype.Ug=function(a,b){F&&(A(a,"number",Hb,"setTo:w"),A(b,"number",Hb,"setTo:h"),0>a&&ya(a,">= 0",Hb,"setTo:w"),0>b&&ya(b,">= 0",Hb,"setTo:h"),this.ha());this.ea=a;this.da=b;return this};Hb.prototype.set=function(a){F&&(x(a,Hb,Hb,"set:s"),this.ha());this.ea=a.ea;this.da=a.da;return this};Hb.prototype.copy=function(){var a=new Hb;a.ea=this.ea;a.da=this.da;return a};t=Hb.prototype;t.ia=function(){this.s=!0;Object.freeze(this);return this};
t.J=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;return this};t.ha=function(a){if(F&&this.s){var b="The Size is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};
function dc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new Hb(c,e)}return new Hb}function ec(a){F&&x(a,Hb);return a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Size("+this.width+","+this.height+")"};t.A=function(a){return a instanceof Hb?this.ea===a.width&&this.da===a.height:!1};t.qj=function(a,b){return this.ea===a&&this.da===b};
t.Ta=function(a){return K.C(this.ea,a.width)&&K.C(this.da,a.height)};t.o=function(){return isFinite(this.width)&&isFinite(this.height)};Hb.alloc=function(){var a=fc.pop();return void 0===a?new Hb:a};Hb.free=function(a){fc.push(a)};
ma.Object.defineProperties(Hb.prototype,{width:{configurable:!0,get:function(){return this.ea},set:function(a){F&&(A(a,"number",Hb,"width"),this.ha(a));0>a&&ya(a,">= 0",Hb,"width");this.ea=a}},height:{configurable:!0,get:function(){return this.da},set:function(a){F&&(A(a,"number",Hb,"height"),this.ha(a));0>a&&ya(a,">= 0",Hb,"height");this.da=a}}});Hb.prototype.isReal=Hb.prototype.o;Hb.prototype.equalsApprox=Hb.prototype.Ta;Hb.prototype.equalTo=Hb.prototype.qj;
Hb.prototype.equals=Hb.prototype.A;Hb.prototype.set=Hb.prototype.set;Hb.prototype.setTo=Hb.prototype.Ug;var fc=[];Hb.className="Size";Hb.parse=dc;Hb.stringify=ec;Hb.ZeroSize=Wb=(new Hb(0,0)).ia();Hb.OneSize=Xb=(new Hb(1,1)).ia();Hb.SixSize=Yb=(new Hb(6,6)).ia();Hb.EightSize=$b=(new Hb(8,8)).ia();Hb.TenSize=ac=(new Hb(10,10)).ia();Hb.InfiniteSize=bc=(new Hb(Infinity,Infinity)).ia();Hb.NoSize=cc=(new Hb(NaN,NaN)).ia();Hb.parse=dc;Hb.stringify=ec;
function L(a,b,c,d){void 0===a?this.da=this.ea=this.H=this.G=0:a instanceof J?(c=a.x,a=a.y,b instanceof J?(d=b.x,b=b.y,this.G=Math.min(c,d),this.H=Math.min(a,b),this.ea=Math.abs(c-d),this.da=Math.abs(a-b)):b instanceof Hb?(this.G=c,this.H=a,this.ea=b.width,this.da=b.height):v("Incorrect arguments supplied to Rect constructor")):"number"===typeof a&&"number"===typeof b&&"number"===typeof c&&(0<=c||isNaN(c))&&"number"===typeof d&&(0<=d||isNaN(d))?(this.G=a,this.H=b,this.ea=c,this.da=d):v("Invalid arguments to Rect constructor: "+
a+", "+b+", "+c+", "+d);this.s=!1}t=L.prototype;t.assign=function(a){this.G=a.G;this.H=a.H;this.ea=a.ea;this.da=a.da;return this};t.h=function(a,b,c,d){this.G=a;this.H=b;this.ea=c;this.da=d;return this};function gc(a,b,c){a.ea=b;a.da=c}t.Ug=function(a,b,c,d){F&&(A(a,"number",L,"setTo:x"),A(b,"number",L,"setTo:y"),A(c,"number",L,"setTo:w"),A(d,"number",L,"setTo:h"),0>c&&ya(c,">= 0",L,"setTo:w"),0>d&&ya(d,">= 0",L,"setTo:h"),this.ha());this.G=a;this.H=b;this.ea=c;this.da=d;return this};
t.set=function(a){F&&(x(a,L,L,"set:r"),this.ha());this.G=a.G;this.H=a.H;this.ea=a.ea;this.da=a.da;return this};t.ud=function(a){F&&(x(a,J,L,"setPoint:p"),this.ha());this.G=a.x;this.H=a.y;return this};t.oB=function(a){F&&(x(a,Hb,L,"setSize:s"),this.ha());this.ea=a.width;this.da=a.height;return this};L.prototype.copy=function(){var a=new L;a.G=this.G;a.H=this.H;a.ea=this.ea;a.da=this.da;return a};t=L.prototype;t.ia=function(){this.s=!0;Object.freeze(this);return this};
t.J=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;return this};t.ha=function(a){if(F&&this.s){var b="The Rect is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};
function hc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return new L(c,e,f,g)}return new L}function ic(a){F&&x(a,L);return a.x.toString()+" "+a.y.toString()+" "+a.width.toString()+" "+a.height.toString()}
t.toString=function(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"};t.A=function(a){return a instanceof L?this.G===a.x&&this.H===a.y&&this.ea===a.width&&this.da===a.height:!1};t.qj=function(a,b,c,d){return this.G===a&&this.H===b&&this.ea===c&&this.da===d};t.Ta=function(a){return K.C(this.G,a.x)&&K.C(this.H,a.y)&&K.C(this.ea,a.width)&&K.C(this.da,a.height)};function jc(a,b){return K.ca(a.G,b.x)&&K.ca(a.H,b.y)&&K.ca(a.ea,b.width)&&K.ca(a.da,b.height)}
t.fa=function(a){F&&x(a,J,L,"containsPoint:p");return this.G<=a.x&&this.G+this.ea>=a.x&&this.H<=a.y&&this.H+this.da>=a.y};t.Qe=function(a){F&&x(a,L,L,"containsRect:r");return this.G<=a.x&&a.x+a.width<=this.G+this.ea&&this.H<=a.y&&a.y+a.height<=this.H+this.da};
t.contains=function(a,b,c,d){F?(C(a,L,"contains:x"),C(b,L,"contains:y"),void 0===c?c=0:C(c,L,"contains:w"),void 0===d?d=0:C(d,L,"contains:h"),(0>c||0>d)&&v("Rect.contains:Width and height cannot be negative")):(void 0===c&&(c=0),void 0===d&&(d=0));return this.G<=a&&a+c<=this.G+this.ea&&this.H<=b&&b+d<=this.H+this.da};t.offset=function(a,b){F&&(C(a,L,"offset:dx"),C(b,L,"offset:dy"),this.ha());this.G+=a;this.H+=b;return this};
t.Oc=function(a,b){F&&(C(a,L,"inflate:w"),C(b,L,"inflate:h"));return kc(this,b,a,b,a)};t.Fq=function(a){F&&x(a,lc,L,"addMargin:m");return kc(this,a.top,a.right,a.bottom,a.left)};t.Ww=function(a){F&&x(a,lc,L,"subtractMargin:m");return kc(this,-a.top,-a.right,-a.bottom,-a.left)};t.HA=function(a,b,c,d){F&&(C(a,L,"grow:t"),C(b,L,"grow:r"),C(c,L,"grow:b"),C(d,L,"grow:l"));return kc(this,a,b,c,d)};
function kc(a,b,c,d,e){F&&a.ha();var f=a.ea;c+e<=-f?(a.G+=f/2,a.ea=0):(a.G-=e,a.ea+=c+e);c=a.da;b+d<=-c?(a.H+=c/2,a.da=0):(a.H-=b,a.da+=b+d);return a}t.MA=function(a){F&&x(a,L,L,"intersectRect:r");return mc(this,a.x,a.y,a.width,a.height)};t.pw=function(a,b,c,d){F&&(C(a,L,"intersect:x"),C(b,L,"intersect:y"),C(c,L,"intersect:w"),C(d,L,"intersect:h"),(0>c||0>d)&&v("Rect.intersect:Width and height cannot be negative"));return mc(this,a,b,c,d)};
function mc(a,b,c,d,e){F&&a.ha();var f=Math.max(a.G,b),g=Math.max(a.H,c);b=Math.min(a.G+a.ea,b+d);c=Math.min(a.H+a.da,c+e);a.G=f;a.H=g;a.ea=Math.max(0,b-f);a.da=Math.max(0,c-g);return a}t.Rc=function(a){F&&x(a,L,L,"intersectsRect:r");return this.qw(a.x,a.y,a.width,a.height)};
t.qw=function(a,b,c,d){F&&(C(a,L,"intersects:x"),C(b,L,"intersects:y"),C(a,L,"intersects:w"),C(b,L,"intersects:h"),(0>c||0>d)&&v("Rect.intersects:Width and height cannot be negative"));var e=this.ea,f=this.G;if(Infinity!==e&&Infinity!==c&&(e+=f,c+=a,isNaN(c)||isNaN(e)||f>c||a>e))return!1;a=this.da;c=this.H;return Infinity!==a&&Infinity!==d&&(a+=c,d+=b,isNaN(d)||isNaN(a)||c>d||b>a)?!1:!0};
function nc(a,b){var c=a.ea,d=a.G,e=b.x-10;if(d>b.width+10+10+e||e>c+d)return!1;c=a.da;a=a.H;d=b.y-10;return a>b.height+10+10+d||d>c+a?!1:!0}t.Ze=function(a){F&&x(a,J,L,"unionPoint:p");return qc(this,a.x,a.y,0,0)};t.Uc=function(a){F&&x(a,L,L,"unionRect:r");return qc(this,a.G,a.H,a.ea,a.da)};
t.ex=function(a,b,c,d){F?(C(a,L,"union:x"),C(b,L,"union:y"),void 0===c?c=0:C(c,L,"union:w"),void 0===d?d=0:C(d,L,"union:h"),(0>c||0>d)&&v("Rect.union:Width and height cannot be negative"),this.ha()):(void 0===c&&(c=0),void 0===d&&(d=0));return qc(this,a,b,c,d)};function qc(a,b,c,d,e){var f=Math.min(a.G,b),g=Math.min(a.H,c);b=Math.max(a.G+a.ea,b+d);c=Math.max(a.H+a.da,c+e);a.G=f;a.H=g;a.ea=b-f;a.da=c-g;return a}
t.Wk=function(a,b,c){F&&(C(a,L,"setSpot:x"),C(b,L,"setSpot:y"),x(c,M,L,"setSpot:spot"),this.ha());this.G=a-c.offsetX-c.x*this.ea;this.H=b-c.offsetY-c.y*this.da;return this};
function rc(a,b,c,d,e,f,g,h){F?(C(a,L,"contains:rx"),C(b,L,"contains:ry"),C(c,L,"contains:rw"),C(d,L,"contains:rh"),C(e,L,"contains:x"),C(f,L,"contains:y"),void 0===g?g=0:C(g,L,"contains:w"),void 0===h?h=0:C(h,L,"contains:h"),(0>c||0>d||0>g||0>h)&&v("Rect.contains:Width and height cannot be negative")):(void 0===g&&(g=0),void 0===h&&(h=0));return a<=e&&e+g<=a+c&&b<=f&&f+h<=b+d}
function sc(a,b,c,d,e,f,g,h){F&&(C(a,L,"intersects:rx"),C(b,L,"intersects:ry"),C(c,L,"intersects:rw"),C(d,L,"intersects:rh"),C(e,L,"intersects:x"),C(f,L,"intersects:y"),C(g,L,"intersects:w"),C(h,L,"intersects:h"),(0>c||0>d||0>g||0>h)&&v("Rect.intersects:Width and height cannot be negative"));return a>g+e||e>c+a?!1:b>h+f||f>d+b?!1:!0}t.o=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)};t.OA=function(){return 0===this.width&&0===this.height};
L.alloc=function(){var a=uc.pop();return void 0===a?new L:a};L.allocAt=function(a,b,c,d){var e=uc.pop();return void 0===e?new L(a,b,c,d):e.h(a,b,c,d)};L.free=function(a){uc.push(a)};
ma.Object.defineProperties(L.prototype,{x:{configurable:!0,get:function(){return this.G},set:function(a){F&&(A(a,"number",L,"x"),this.ha(a));this.G=a}},y:{configurable:!0,get:function(){return this.H},set:function(a){F&&(A(a,"number",L,"y"),this.ha(a));this.H=a}},width:{configurable:!0,get:function(){return this.ea},set:function(a){F&&(A(a,"number",L,"width"),this.ha(a));0>a&&ya(a,">= 0",L,"width");this.ea=a}},height:{configurable:!0,get:function(){return this.da},
set:function(a){F&&(A(a,"number",L,"height"),this.ha(a));0>a&&ya(a,">= 0",L,"height");this.da=a}},left:{configurable:!0,get:function(){return this.G},set:function(a){F&&(A(a,"number",L,"left"),this.ha(a));this.G=a}},top:{configurable:!0,get:function(){return this.H},set:function(a){F&&(A(a,"number",L,"top"),this.ha(a));this.H=a}},right:{configurable:!0,get:function(){return this.G+this.ea},set:function(a){F&&(C(a,L,"right"),this.ha(a));this.G+=a-(this.G+this.ea)}},
bottom:{configurable:!0,get:function(){return this.H+this.da},set:function(a){F&&(C(a,L,"top"),this.ha(a));this.H+=a-(this.H+this.da)}},position:{configurable:!0,get:function(){return new J(this.G,this.H)},set:function(a){F&&(x(a,J,L,"position"),this.ha(a));this.G=a.x;this.H=a.y}},size:{configurable:!0,get:function(){return new Hb(this.ea,this.da)},set:function(a){F&&(x(a,Hb,L,"size"),this.ha(a));this.ea=a.width;this.da=a.height}},center:{configurable:!0,
enumerable:!0,get:function(){return new J(this.G+this.ea/2,this.H+this.da/2)},set:function(a){F&&(x(a,J,L,"center"),this.ha(a));this.G=a.x-this.ea/2;this.H=a.y-this.da/2}},centerX:{configurable:!0,get:function(){return this.G+this.ea/2},set:function(a){F&&(C(a,L,"centerX"),this.ha(a));this.G=a-this.ea/2}},centerY:{configurable:!0,get:function(){return this.H+this.da/2},set:function(a){F&&(C(a,L,"centerY"),this.ha(a));this.H=a-this.da/2}}});L.prototype.isEmpty=L.prototype.OA;
L.prototype.isReal=L.prototype.o;L.intersectsLineSegment=function(a,b,c,d,e,f,g,h){F&&(C(a,L,"intersectsLineSegment:x"),C(b,L,"intersectsLineSegment:y"),C(c,L,"intersectsLineSegment:w"),C(d,L,"intersectsLineSegment:h"),C(e,L,"intersectsLineSegment:p1x"),C(f,L,"intersectsLineSegment:p1y"),C(g,L,"intersectsLineSegment:p2x"),C(h,L,"intersectsLineSegment:p2y"),(0>c||0>d)&&v("Rect.intersectsLineSegment: width and height cannot be negative"));return K.Qy(a,b,c,d,e,f,g,h)};L.prototype.setSpot=L.prototype.Wk;
L.prototype.union=L.prototype.ex;L.prototype.unionRect=L.prototype.Uc;L.prototype.unionPoint=L.prototype.Ze;L.prototype.intersects=L.prototype.qw;L.prototype.intersectsRect=L.prototype.Rc;L.prototype.intersect=L.prototype.pw;L.prototype.intersectRect=L.prototype.MA;L.prototype.grow=L.prototype.HA;L.prototype.subtractMargin=L.prototype.Ww;L.prototype.addMargin=L.prototype.Fq;L.prototype.inflate=L.prototype.Oc;L.prototype.offset=L.prototype.offset;L.prototype.contains=L.prototype.contains;
L.prototype.containsRect=L.prototype.Qe;L.prototype.containsPoint=L.prototype.fa;L.prototype.equalsApprox=L.prototype.Ta;L.prototype.equalTo=L.prototype.qj;L.prototype.equals=L.prototype.A;L.prototype.setSize=L.prototype.oB;L.prototype.setPoint=L.prototype.ud;L.prototype.set=L.prototype.set;L.prototype.setTo=L.prototype.Ug;var vc=null,wc=null,uc=[];L.className="Rect";L.parse=hc;L.stringify=ic;L.contains=rc;L.intersects=sc;L.ZeroRect=vc=(new L(0,0,0,0)).ia();L.NoRect=wc=(new L(NaN,NaN,NaN,NaN)).ia();
L.parse=hc;L.stringify=ic;L.contains=rc;L.intersects=sc;function lc(a,b,c,d){void 0===a?this.Be=this.oe=this.Ke=this.Me=0:void 0===b?this.left=this.bottom=this.right=this.top=a:void 0===c?(this.top=a,this.right=b,this.bottom=a,this.left=b):void 0!==d?(this.top=a,this.right=b,this.bottom=c,this.left=d):v("Invalid arguments to Margin constructor: "+a+", "+b+", "+c+", "+d);this.s=!1}lc.prototype.assign=function(a){this.Me=a.Me;this.Ke=a.Ke;this.oe=a.oe;this.Be=a.Be;return this};
lc.prototype.Ug=function(a,b,c,d){F&&(A(a,"number",lc,"setTo:t"),A(b,"number",lc,"setTo:r"),A(c,"number",lc,"setTo:b"),A(d,"number",lc,"setTo:l"),this.ha());this.Me=a;this.Ke=b;this.oe=c;this.Be=d;return this};lc.prototype.set=function(a){F&&(x(a,lc,lc,"assign:m"),this.ha());this.Me=a.Me;this.Ke=a.Ke;this.oe=a.oe;this.Be=a.Be;return this};lc.prototype.copy=function(){var a=new lc;a.Me=this.Me;a.Ke=this.Ke;a.oe=this.oe;a.Be=this.Be;return a};t=lc.prototype;
t.ia=function(){this.s=!0;Object.freeze(this);return this};t.J=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;return this};t.ha=function(a){if(F&&this.s){var b="The Margin is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};
function xc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=NaN;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));if(isNaN(c))return new lc;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new lc(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new lc(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new lc(c,e):new lc(c,e,f,g)}return new lc}
function yc(a){F&&x(a,lc);return a.top.toString()+" "+a.right.toString()+" "+a.bottom.toString()+" "+a.left.toString()}t.toString=function(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"};t.A=function(a){return a instanceof lc?this.Me===a.top&&this.Ke===a.right&&this.oe===a.bottom&&this.Be===a.left:!1};t.qj=function(a,b,c,d){return this.Me===a&&this.Ke===b&&this.oe===c&&this.Be===d};
t.Ta=function(a){return K.C(this.Me,a.top)&&K.C(this.Ke,a.right)&&K.C(this.oe,a.bottom)&&K.C(this.Be,a.left)};t.o=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};lc.alloc=function(){var a=zc.pop();return void 0===a?new lc:a};lc.free=function(a){zc.push(a)};
ma.Object.defineProperties(lc.prototype,{top:{configurable:!0,get:function(){return this.Me},set:function(a){F&&(C(a,lc,"top"),this.ha(a));this.Me=a}},right:{configurable:!0,get:function(){return this.Ke},set:function(a){F&&(C(a,lc,"right"),this.ha(a));this.Ke=a}},bottom:{configurable:!0,get:function(){return this.oe},set:function(a){F&&(C(a,lc,"bottom"),this.ha(a));this.oe=a}},left:{configurable:!0,get:function(){return this.Be},set:function(a){F&&
(C(a,lc,"left"),this.ha(a));this.Be=a}}});lc.prototype.isReal=lc.prototype.o;lc.prototype.equalsApprox=lc.prototype.Ta;lc.prototype.equalTo=lc.prototype.qj;lc.prototype.equals=lc.prototype.A;lc.prototype.set=lc.prototype.set;lc.prototype.setTo=lc.prototype.Ug;var Ec=null,Fc=null,zc=[];lc.className="Margin";lc.parse=xc;lc.stringify=yc;lc.ZeroMargin=Ec=(new lc(0,0,0,0)).ia();lc.TwoMargin=Fc=(new lc(2,2,2,2)).ia();lc.parse=xc;lc.stringify=yc;
function M(a,b,c,d){void 0===a?this.ae=this.$d=this.H=this.G=0:(void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),this.x=a,this.y=b,this.offsetX=c,this.offsetY=d);this.s=!1}var Gc,Hc,Ic,Jc,Lc,Mc,Nc,Oc,Pc,Sc,Tc,Uc,Vc,Wc,Xc,Yc,Zc,$c,bd,cd,dd,ed,fd,gd,hd,ld,md,nd,od,pd,qd,rd,sd,td,ud,vd;M.prototype.assign=function(a){this.G=a.G;this.H=a.H;this.$d=a.$d;this.ae=a.ae;return this};
M.prototype.Ug=function(a,b,c,d){F&&(wd(a,"setTo:x"),wd(b,"setTo:y"),xd(c,"setTo:offx"),xd(d,"setTo:offy"),this.ha());this.G=a;this.H=b;this.$d=c;this.ae=d;return this};M.prototype.set=function(a){F&&(x(a,M,M,"set:s"),this.ha());this.G=a.G;this.H=a.H;this.$d=a.$d;this.ae=a.ae;return this};M.prototype.copy=function(){var a=new M;a.G=this.G;a.H=this.H;a.$d=this.$d;a.ae=this.ae;return a};t=M.prototype;t.ia=function(){this.s=!0;Object.freeze(this);return this};
t.J=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;return this};t.ha=function(a){if(F&&this.s){var b="The Spot is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};function yd(a,b){a.G=NaN;a.H=NaN;a.$d=b;return a}function wd(a,b){(isNaN(a)||1<a||0>a)&&ya(a,"0 <= "+b+" <= 1",M,b)}
function xd(a,b){(isNaN(a)||Infinity===a||-Infinity===a)&&ya(a,"real number, not NaN or Infinity",M,b)}
function zd(a){if("string"===typeof a){a=a.trim();if("None"===a)return Gc;if("TopLeft"===a)return Hc;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return Ic;if("TopRight"===a)return Jc;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return Lc;if("Center"===a)return Mc;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return Nc;if("BottomLeft"===a)return Oc;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return Pc;if("BottomRight"===a)return Sc;if("TopSide"===a)return Tc;if("LeftSide"===
a)return Uc;if("RightSide"===a)return Vc;if("BottomSide"===a)return Wc;if("TopBottomSides"===a)return Xc;if("LeftRightSides"===a)return Yc;if("TopLeftSides"===a)return Zc;if("TopRightSides"===a)return $c;if("BottomLeftSides"===a)return bd;if("BottomRightSides"===a)return cd;if("NotTopSide"===a)return dd;if("NotLeftSide"===a)return ed;if("NotRightSide"===a)return fd;if("NotBottomSide"===a)return gd;if("AllSides"===a)return hd;if("Default"===a)return ld;a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;
var d=a[b++];void 0!==d&&0<d.length&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(g=parseFloat(d));return new M(c,e,f,g)}return new M}function Ad(a){F&&x(a,M);return a.cb()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()}
t.toString=function(){return this.cb()?0===this.$d&&0===this.ae?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.A(Gc)?"None":this.A(Hc)?"TopLeft":this.A(Ic)?"Top":this.A(Jc)?"TopRight":this.A(Lc)?"Left":this.A(Mc)?"Center":this.A(Nc)?"Right":this.A(Oc)?"BottomLeft":this.A(Pc)?"Bottom":this.A(Sc)?"BottomRight":this.A(Tc)?"TopSide":this.A(Uc)?"LeftSide":this.A(Vc)?"RightSide":this.A(Wc)?"BottomSide":this.A(Xc)?"TopBottomSides":this.A(Yc)?"LeftRightSides":
this.A(Zc)?"TopLeftSides":this.A($c)?"TopRightSides":this.A(bd)?"BottomLeftSides":this.A(cd)?"BottomRightSides":this.A(dd)?"NotTopSide":this.A(ed)?"NotLeftSide":this.A(fd)?"NotRightSide":this.A(gd)?"NotBottomSide":this.A(hd)?"AllSides":this.A(ld)?"Default":"None"};t.A=function(a){return a instanceof M?(this.G===a.x||isNaN(this.G)&&isNaN(a.x))&&(this.H===a.y||isNaN(this.H)&&isNaN(a.y))&&this.$d===a.offsetX&&this.ae===a.offsetY:!1};
t.yw=function(){return new M(.5-(this.G-.5),.5-(this.H-.5),-this.$d,-this.ae)};t.Pf=function(a){if(!this.Sc())return!1;if(!a.Sc())if(a.A(md))a=Uc;else if(a.A(nd))a=Vc;else if(a.A(od))a=Tc;else if(a.A(pd))a=Wc;else return!1;a=a.offsetY;return(this.ae&a)===a};t.cb=function(){return!isNaN(this.x)&&!isNaN(this.y)};t.Sb=function(){return isNaN(this.x)||isNaN(this.y)};t.Sc=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY};
t.ar=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};t.Ib=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};M.alloc=function(){var a=Bd.pop();return void 0===a?new M:a};M.free=function(a){Bd.push(a)};
ma.Object.defineProperties(M.prototype,{x:{configurable:!0,get:function(){return this.G},set:function(a){F&&(wd(a,"x"),this.ha(a));this.G=a}},y:{configurable:!0,get:function(){return this.H},set:function(a){F&&(wd(a,"y"),this.ha(a));this.H=a}},offsetX:{configurable:!0,get:function(){return this.$d},set:function(a){F&&(xd(a,"offsetX"),this.ha(a));this.$d=a}},offsetY:{configurable:!0,get:function(){return this.ae},set:function(a){F&&(xd(a,"offsetY"),
this.ha(a));this.ae=a}}});M.prototype.isDefault=M.prototype.Ib;M.prototype.isNone=M.prototype.ar;M.prototype.isSide=M.prototype.Sc;M.prototype.isNoSpot=M.prototype.Sb;M.prototype.isSpot=M.prototype.cb;M.prototype.includesSide=M.prototype.Pf;M.prototype.opposite=M.prototype.yw;M.prototype.equals=M.prototype.A;M.prototype.set=M.prototype.set;M.prototype.setTo=M.prototype.Ug;var Bd=[];M.className="Spot";M.parse=zd;M.stringify=Ad;M.None=Gc=yd(new M(0,0,0,0),0).ia();M.Default=ld=yd(new M(0,0,-1,0),-1).ia();
M.TopLeft=Hc=(new M(0,0,0,0)).ia();M.TopCenter=Ic=(new M(.5,0,0,0)).ia();M.TopRight=Jc=(new M(1,0,0,0)).ia();M.LeftCenter=Lc=(new M(0,.5,0,0)).ia();M.Center=Mc=(new M(.5,.5,0,0)).ia();M.RightCenter=Nc=(new M(1,.5,0,0)).ia();M.BottomLeft=Oc=(new M(0,1,0,0)).ia();M.BottomCenter=Pc=(new M(.5,1,0,0)).ia();M.BottomRight=Sc=(new M(1,1,0,0)).ia();M.MiddleTop=qd=Ic;M.MiddleLeft=rd=Lc;M.MiddleRight=sd=Nc;M.MiddleBottom=td=Pc;M.Top=od=Ic;M.Left=md=Lc;M.Right=nd=Nc;M.Bottom=pd=Pc;
M.TopSide=Tc=yd(new M(0,0,1,1),1).ia();M.LeftSide=Uc=yd(new M(0,0,1,2),1).ia();M.RightSide=Vc=yd(new M(0,0,1,4),1).ia();M.BottomSide=Wc=yd(new M(0,0,1,8),1).ia();M.TopBottomSides=Xc=yd(new M(0,0,1,9),1).ia();M.LeftRightSides=Yc=yd(new M(0,0,1,6),1).ia();M.TopLeftSides=Zc=yd(new M(0,0,1,3),1).ia();M.TopRightSides=$c=yd(new M(0,0,1,5),1).ia();M.BottomLeftSides=bd=yd(new M(0,0,1,10),1).ia();M.BottomRightSides=cd=yd(new M(0,0,1,12),1).ia();M.NotTopSide=dd=yd(new M(0,0,1,14),1).ia();
M.NotLeftSide=ed=yd(new M(0,0,1,13),1).ia();M.NotRightSide=fd=yd(new M(0,0,1,11),1).ia();M.NotBottomSide=gd=yd(new M(0,0,1,7),1).ia();M.AllSides=hd=yd(new M(0,0,1,15),1).ia();ud=(new M(.156,.156)).ia();vd=(new M(.844,.844)).ia();M.parse=zd;M.stringify=Ad;function Ib(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}Ib.prototype.set=function(a){this.m11=a.m11;this.m12=a.m12;this.m21=a.m21;this.m22=a.m22;this.dx=a.dx;this.dy=a.dy;return this};
Ib.prototype.copy=function(){var a=new Ib;a.m11=this.m11;a.m12=this.m12;a.m21=this.m21;a.m22=this.m22;a.dx=this.dx;a.dy=this.dy;return a};t=Ib.prototype;t.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};t.A=function(a){return this.m11===a.m11&&this.m12===a.m12&&this.m21===a.m21&&this.m22===a.m22&&this.dx===a.dx&&this.dy===a.dy};t.gu=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22};
t.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this};t.multiply=function(a){var b=this.m11*a.m11+this.m21*a.m12,c=this.m12*a.m11+this.m22*a.m12,d=this.m11*a.m21+this.m21*a.m22,e=this.m12*a.m21+this.m22*a.m22;this.dx=this.m11*a.dx+this.m21*a.dy+this.dx;this.dy=this.m12*a.dx+this.m22*a.dy+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this};
t.ww=function(a){var b=1/(a.m11*a.m22-a.m12*a.m21),c=a.m22*b,d=-a.m12*b,e=-a.m21*b,f=a.m11*b,g=b*(a.m21*a.dy-a.m22*a.dx);a=b*(a.m12*a.dx-a.m11*a.dy);b=this.m11*c+this.m21*d;c=this.m12*c+this.m22*d;d=this.m11*e+this.m21*f;e=this.m12*e+this.m22*f;this.dx=this.m11*g+this.m21*a+this.dx;this.dy=this.m12*g+this.m22*a+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this};
t.eu=function(){var a=1/(this.m11*this.m22-this.m12*this.m21),b=-this.m12*a,c=-this.m21*a,d=this.m11*a,e=a*(this.m21*this.dy-this.m22*this.dx),f=a*(this.m12*this.dx-this.m11*this.dy);this.m11=this.m22*a;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this};
Ib.prototype.rotate=function(a,b,c){F&&(C(a,Ib,"rotate:angle"),C(b,Ib,"rotate:rx"),C(c,Ib,"rotate:ry"));360<=a?a-=360:0>a&&(a+=360);if(0===a)return this;this.translate(b,c);if(90===a){a=0;var d=1}else 180===a?(a=-1,d=0):270===a?(a=0,d=-1):(d=a*Math.PI/180,a=Math.cos(d),d=Math.sin(d));var e=this.m12*a+this.m22*d,f=this.m11*-d+this.m21*a,g=this.m12*-d+this.m22*a;this.m11=this.m11*a+this.m21*d;this.m12=e;this.m21=f;this.m22=g;this.translate(-b,-c);return this};t=Ib.prototype;
t.translate=function(a,b){F&&(C(a,Ib,"translate:x"),C(b,Ib,"translate:y"));this.dx+=this.m11*a+this.m21*b;this.dy+=this.m12*a+this.m22*b;return this};t.scale=function(a,b){void 0===b&&(b=a);F&&(C(a,Ib,"translate:sx"),C(b,Ib,"translate:sy"));this.m11*=a;this.m12*=a;this.m21*=b;this.m22*=b;return this};t.ya=function(a){var b=a.x,c=a.y;return a.h(b*this.m11+c*this.m21+this.dx,b*this.m12+c*this.m22+this.dy)};
t.ge=function(a){var b=1/(this.m11*this.m22-this.m12*this.m21),c=a.x,d=a.y;return a.h(c*this.m22*b+d*-this.m21*b+b*(this.m21*this.dy-this.m22*this.dx),c*-this.m12*b+d*this.m11*b+b*(this.m12*this.dx-this.m11*this.dy))};
t.bx=function(a){var b=a.x,c=a.y,d=b+a.width,e=c+a.height,f=this.m11,g=this.m12,h=this.m21,k=this.m22,l=this.dx,m=this.dy,n=b*f+c*h+l,p=b*g+c*k+m,r=d*f+c*h+l,q=d*g+c*k+m;c=b*f+e*h+l;b=b*g+e*k+m;f=d*f+e*h+l;d=d*g+e*k+m;e=Math.min(n,r);n=Math.max(n,r);r=Math.min(p,q);p=Math.max(p,q);e=Math.min(e,c);n=Math.max(n,c);r=Math.min(r,b);p=Math.max(p,b);e=Math.min(e,f);n=Math.max(n,f);r=Math.min(r,d);p=Math.max(p,d);a.h(e,r,n-e,p-r);return a};Ib.alloc=function(){var a=Ed.pop();return void 0===a?new Ib:a};
Ib.free=function(a){Ed.push(a)};Ib.prototype.transformRect=Ib.prototype.bx;Ib.prototype.invertedTransformPoint=Ib.prototype.ge;Ib.prototype.transformPoint=Ib.prototype.ya;Ib.prototype.scale=Ib.prototype.scale;Ib.prototype.translate=Ib.prototype.translate;Ib.prototype.rotate=Ib.prototype.rotate;Ib.prototype.invert=Ib.prototype.eu;Ib.prototype.multiplyInverted=Ib.prototype.ww;Ib.prototype.multiply=Ib.prototype.multiply;Ib.prototype.reset=Ib.prototype.reset;Ib.prototype.isIdentity=Ib.prototype.gu;
Ib.prototype.equals=Ib.prototype.A;Ib.prototype.set=Ib.prototype.set;var Ed=[];Ib.className="Transform";Ib.xF="54a702f3e53909c447824c6706603faf4c";
var K={yB:"7da71ca0ad381e90",Wg:(Math.sqrt(2)-1)/3*4,wx:null,sqrt:function(a){if(0>=a)return 0;var b=K.wx;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);K.wx=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)},C:function(a,b){a-=b;return.5>a&&-.5<a},ca:function(a,b){a-=b;return 5E-8>a&&-5E-8<a},Tb:function(a,b,c,d,e,f,g){0>=e&&(e=1E-6);if(a<c){var h=a;var k=c}else h=c,k=a;if(b<d){var l=b;var m=d}else l=d,m=b;if(a===c)return l<=g&&g<=m&&a-e<=f&&f<=a+e;if(b===d)return h<=
f&&f<=k&&b-e<=g&&g<=b+e;k+=e;h-=e;if(h<=f&&f<=k&&(m+=e,l-=e,l<=g&&g<=m))if(k-h>m-l)if(a-c>e||c-a>e){if(f=(d-b)/(c-a)*(f-a)+b,f-e<=g&&g<=f+e)return!0}else return!0;else if(b-d>e||d-b>e){if(g=(c-a)/(d-b)*(g-b)+a,g-e<=f&&f<=g+e)return!0}else return!0;return!1},Lt:function(a,b,c,d,e,f,g,h,k,l,m,n){if(K.Tb(a,b,g,h,n,c,d)&&K.Tb(a,b,g,h,n,e,f))return K.Tb(a,b,g,h,n,l,m);var p=(a+c)/2,r=(b+d)/2,q=(c+e)/2,u=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(p+q)/2;c=(r+u)/2;q=(q+e)/2;u=(u+f)/2;var w=(d+q)/2,y=(c+u)/2;return K.Lt(a,
b,p,r,d,c,w,y,k,l,m,n)||K.Lt(w,y,q,u,e,f,g,h,k,l,m,n)},Kz:function(a,b,c,d,e,f,g,h,k){var l=(c+e)/2,m=(d+f)/2;k.h((((a+c)/2+l)/2+(l+(e+g)/2)/2)/2,(((b+d)/2+m)/2+(m+(f+h)/2)/2)/2);return k},Jz:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return Mb(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},Cm:function(a,b,c,d,e,f,g,h,k,l){if(K.Tb(a,b,g,h,k,c,d)&&K.Tb(a,b,g,h,k,e,f))qc(l,a,b,0,0),qc(l,g,h,0,0);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,r=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+r)/
2;p=(p+e)/2;r=(r+f)/2;var q=(d+p)/2,u=(c+r)/2;K.Cm(a,b,m,n,d,c,q,u,k,l);K.Cm(q,u,p,r,e,f,g,h,k,l)}return l},Pe:function(a,b,c,d,e,f,g,h,k,l){if(K.Tb(a,b,g,h,k,c,d)&&K.Tb(a,b,g,h,k,e,f))0===l.length&&(l.push(a),l.push(b)),l.push(g),l.push(h);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,r=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+r)/2;p=(p+e)/2;r=(r+f)/2;var q=(d+p)/2,u=(c+r)/2;K.Pe(a,b,m,n,d,c,q,u,k,l);K.Pe(q,u,p,r,e,f,g,h,k,l)}return l},Bw:function(a,b,c,d,e,f,g,h,k,l){if(K.Tb(a,b,e,f,l,c,d))return K.Tb(a,
b,e,f,l,h,k);var m=(a+c)/2,n=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var p=(m+c)/2,r=(n+d)/2;return K.Bw(a,b,m,n,p,r,g,h,k,l)||K.Bw(p,r,c,d,e,f,g,h,k,l)},IB:function(a,b,c,d,e,f,g){g.h(((a+c)/2+(c+e)/2)/2,((b+d)/2+(d+f)/2)/2);return g},Aw:function(a,b,c,d,e,f,g,h){if(K.Tb(a,b,e,f,g,c,d))qc(h,a,b,0,0),qc(h,e,f,0,0);else{var k=(a+c)/2,l=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var m=(k+c)/2,n=(l+d)/2;K.Aw(a,b,k,l,m,n,g,h);K.Aw(m,n,c,d,e,f,g,h)}return h},jr:function(a,b,c,d,e,f,g,h){if(K.Tb(a,b,e,f,g,c,d))0===h.length&&(h.push(a),
h.push(b)),h.push(e),h.push(f);else{var k=(a+c)/2,l=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var m=(k+c)/2,n=(l+d)/2;K.jr(a,b,k,l,m,n,g,h);K.jr(m,n,c,d,e,f,g,h)}return h},Hq:function(a,b,c,d,e,f,g,h,k,l,m,n,p,r){if(K.Tb(a,b,g,h,p,c,d)&&K.Tb(a,b,g,h,p,e,f)){if(a<k&&g<k&&a<m&&g<m||a>k&&g>k&&a>m&&g>m||b<l&&h<l&&b<n&&h<n||b>l&&h>l&&b>n&&h>n)return!1;var q=(a-g)*(l-n)-(b-h)*(k-m);if(0===q)return!1;p=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/q;q=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/q;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?g=b:
(g=h,h=b),1E-5+q<g||q>h+1E-5)return!1}else if(a<g?h=a:(h=g,g=a),1E-5+p<h||p>g+1E-5)return!1;r.h(p,q);return!0}q=(a+c)/2;var u=(b+d)/2,w=(c+e)/2,y=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+w)/2;c=(u+y)/2;w=(w+e)/2;y=(y+f)/2;var z=(d+w)/2,B=(c+y)/2,D=(m-k)*(m-k)+(n-l)*(n-l),G=!1,O=0,T=0;K.Hq(a,b,q,u,d,c,z,B,k,l,m,n,p,r)&&(a=(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l),a<D&&(D=a,G=!0,O=r.x,T=r.y));K.Hq(z,B,w,y,e,f,g,h,k,l,m,n,p,r)&&(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l)<D&&(G=!0,O=r.x,T=r.y);G&&(r.x=O,r.y=T);return G},Iq:function(a,
b,c,d,e,f,g,h,k,l,m,n,p){var r=0;if(K.Tb(a,b,g,h,p,c,d)&&K.Tb(a,b,g,h,p,e,f)){p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return r;var q=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/p,u=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/p;if(q>=m)return r;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?(a=b,b=h):a=h,u<a||u>b)return r}else if(a<g?(b=a,a=g):b=g,q<b||q>a)return r;0<p?r++:0>p&&r--}else{q=(a+c)/2;u=(b+d)/2;var w=(c+e)/2,y=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+w)/2;c=(u+y)/2;w=(w+e)/2;y=(y+f)/2;var z=(d+w)/2,B=(c+y)/2;r+=K.Iq(a,b,q,u,d,
c,z,B,k,l,m,n,p);r+=K.Iq(z,B,w,y,e,f,g,h,k,l,m,n,p)}return r},ai:function(a,b,c,d,e,f,g){if(K.ca(a,c)){b<d?(c=b,b=d):c=d;if(f<c)return g.h(a,c),!1;if(f>b)return g.h(a,b),!1;g.h(a,f);return!0}if(K.ca(b,d)){a<c?(d=a,a=c):d=c;if(e<d)return g.h(d,b),!1;if(e>a)return g.h(a,b),!1;g.h(e,b);return!0}e=((a-e)*(a-c)+(b-f)*(b-d))/((c-a)*(c-a)+(d-b)*(d-b));if(-5E-6>e)return g.h(a,b),!1;if(1.000005<e)return g.h(c,d),!1;g.h(a+e*(c-a),b+e*(d-b));return!0},Ve:function(a,b,c,d,e,f,g,h,k){if(K.C(a,c)&&K.C(b,d))return k.h(a,
b),!1;if(K.ca(e,g))return K.ca(a,c)?(K.ai(a,b,c,d,e,f,k),!1):K.ai(a,b,c,d,e,(d-b)/(c-a)*(e-a)+b,k);h=(h-f)/(g-e);if(K.ca(a,c)){c=h*(a-e)+f;b<d?(e=b,b=d):e=d;if(c<e)return k.h(a,e),!1;if(c>b)return k.h(a,b),!1;k.h(a,c);return!0}g=(d-b)/(c-a);if(K.ca(h,g))return K.ai(a,b,c,d,e,f,k),!1;e=(g*a-h*e+f-b)/(g-h);if(K.ca(g,0)){a<c?(d=a,a=c):d=c;if(e<d)return k.h(d,b),!1;if(e>a)return k.h(a,b),!1;k.h(e,b);return!0}return K.ai(a,b,c,d,e,g*(e-a)+b,k)},GB:function(a,b,c,d,e){return K.Ve(c.x,c.y,d.x,d.y,a.x,a.y,
b.x,b.y,e)},FB:function(a,b,c,d,e,f,g,h,k,l){function m(c,d){var e=(c-a)*(c-a)+(d-b)*(d-b);e<n&&(n=e,k.h(c,d))}var n=Infinity;m(k.x,k.y);var p=0,r=0,q=0,u=0;e<g?(p=e,r=g):(p=g,r=e);f<h?(q=e,u=g):(q=g,u=e);p=(r-p)/2+l;l=(u-q)/2+l;e=(e+g)/2;f=(f+h)/2;if(0===p||0===l)return k;if(.5>(c>a?c-a:a-c)){p=1-(c-e)*(c-e)/(p*p);if(0>p)return k;p=Math.sqrt(p);d=-l*p+f;m(c,l*p+f);m(c,d)}else{c=(d-b)/(c-a);d=1/(p*p)+c*c/(l*l);h=2*c*(b-c*a)/(l*l)-2*c*f/(l*l)-2*e/(p*p);p=h*h-4*d*(2*c*a*f/(l*l)-2*b*f/(l*l)+f*f/(l*l)+
e*e/(p*p)-1+(b-c*a)*(b-c*a)/(l*l));if(0>p)return k;p=Math.sqrt(p);l=(-h+p)/(2*d);m(l,c*l-c*a+b);p=(-h-p)/(2*d);m(p,c*p-c*a+b)}return k},hd:function(a,b,c,d,e,f,g,h,k){var l=1E21,m=a,n=b;if(K.Ve(a,b,a,d,e,f,g,h,k)){var p=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f);p<l&&(l=p,m=k.x,n=k.y)}K.Ve(c,b,c,d,e,f,g,h,k)&&(p=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),p<l&&(l=p,m=k.x,n=k.y));K.Ve(a,b,c,b,e,f,g,h,k)&&(b=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),b<l&&(l=b,m=k.x,n=k.y));K.Ve(a,d,c,d,e,f,g,h,k)&&(a=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),
a<l&&(l=a,m=k.x,n=k.y));k.h(m,n);return 1E21>l},EB:function(a,b,c,d,e,f,g,h,k){c=a-c;g=e-g;0===c||0===g?0===c?(b=(f-h)/g,h=a,e=b*h+(f-b*e)):(f=(b-d)/c,h=e,e=f*h+(b-f*a)):(d=(b-d)/c,h=(f-h)/g,a=b-d*a,h=(f-h*e-a)/(d-h),e=d*h+a);k.h(h,e);return k},cu:function(a,b,c){return K.Qy(a.x,a.y,a.width,a.height,b.x,b.y,c.x,c.y)},Qy:function(a,b,c,d,e,f,g,h){var k=a+c,l=b+d;return e===g?(f<h?(g=f,f=h):g=h,a<=e&&e<=k&&g<=l&&f>=b):f===h?(e<g?(h=e,e=g):h=g,b<=f&&f<=l&&h<=k&&e>=a):rc(a,b,c,d,e,f)||rc(a,b,c,d,g,h)||
K.Zq(a,b,k,b,e,f,g,h)||K.Zq(k,b,k,l,e,f,g,h)||K.Zq(k,l,a,l,e,f,g,h)||K.Zq(a,l,a,b,e,f,g,h)?!0:!1},Zq:function(a,b,c,d,e,f,g,h){return 0>=K.Ot(a,b,c,d,e,f)*K.Ot(a,b,c,d,g,h)&&0>=K.Ot(e,f,g,h,a,b)*K.Ot(e,f,g,h,c,d)},Ot:function(a,b,c,d,e,f){c-=a;d-=b;a=e-a;b=f-b;f=a*d-b*c;0===f&&(f=a*c+b*d,0<f&&(f=(a-c)*c+(b-d)*d,0>f&&(f=0)));return 0>f?-1:0<f?1:0},gr:function(a){0>a&&(a+=360);360<=a&&(a-=360);return a},ty:function(a,b,c,d,e,f){var g=Math.PI;f||(d*=g/180,e*=g/180);var h=d>e?-1:1;f=[];var k=g/2,l=d;
d=Math.min(2*g,Math.abs(e-d));if(1E-5>d)return k=l+h*Math.min(d,k),h=a+c*Math.cos(l),l=b+c*Math.sin(l),a+=c*Math.cos(k),b+=c*Math.sin(k),c=(h+a)/2,k=(l+b)/2,f.push([h,l,c,k,c,k,a,b]),f;for(;1E-5<d;)e=l+h*Math.min(d,k),f.push(K.Tz(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},Tz:function(a,b,c,d,e){var f=(c-b)/2,g=a*Math.cos(f),h=a*Math.sin(f),k=-h,l=g*g+k*k,m=l+g*g+k*h;l=4/3*(Math.sqrt(2*l*m)-m)/(g*h-k*g);h=g-l*k;g=k+l*g;k=-g;l=f+b;f=Math.cos(l);l=Math.sin(l);return[d+a*Math.cos(b),e+a*Math.sin(b),d+
h*f-g*l,e+h*l+g*f,d+h*f-k*l,e+h*l+k*f,d+a*Math.cos(c),e+a*Math.sin(c)]},Rq:function(a,b,c,d,e,f,g){c=Math.floor((a-c)/e)*e+c;d=Math.floor((b-d)/f)*f+d;var h=c;c+e-a<e/2&&(h=c+e);a=d;d+f-b<f/2&&(a=d+f);g.h(h,a);return g},Gy:function(a,b){var c=Math.max(a,b);a=Math.min(a,b);var d;do b=c%a,c=d=a,a=b;while(0<b);return d},Yz:function(a,b,c,d){var e=0>c,f=0>d;if(a<b){var g=1;var h=0}else g=0,h=1;var k=0===g?a:b;var l=0===g?c:d;if(0===g?e:f)l=-l;g=h;c=0===g?c:d;if(0===g?e:f)c=-c;return K.Zz(k,0===g?a:b,
l,c,0,0)},Zz:function(a,b,c,d,e,f){if(0<d)if(0<c){e=a*a;f=b*b;a*=c;var g=b*d,h=-f+g,k=-f+Math.sqrt(a*a+g*g);b=h;for(var l=0;9999999999>l;++l){b=.5*(h+k);if(b===h||b===k)break;var m=a/(b+e),n=g/(b+f);m=m*m+n*n-1;if(0<m)h=b;else if(0>m)k=b;else break}c=e*c/(b+e)-c;d=f*d/(b+f)-d;c=Math.sqrt(c*c+d*d)}else c=Math.abs(d-b);else d=a*a-b*b,f=a*c,f<d?(d=f/d,f=b*Math.sqrt(Math.abs(1-d*d)),c=a*d-c,c=Math.sqrt(c*c+f*f)):c=Math.abs(c-a);return c},me:new jb,pn:new jb,ei:new jb,fi:0};K.za=K.yB;
function Fd(a){F&&1<arguments.length&&v("Geometry constructor can take at most one optional argument, the Geometry type.");fb(this);this.s=!1;void 0===a?a=Gd:F&&hb(a,Fd,Fd,"constructor:type");this.sa=a;this.sc=this.mc=this.fd=this.ed=0;this.Sj=new H;this.os=this.Sj.u;this.Vr=(new L).freeze();this.wa=!0;this.wn=this.fl=null;this.xn=NaN;this.Af=Hc;this.Bf=Sc;this.Jl=this.Kl=NaN;this.cg=Hd}
Fd.prototype.copy=function(){var a=new Fd;a.sa=this.sa;a.ed=this.ed;a.fd=this.fd;a.mc=this.mc;a.sc=this.sc;for(var b=this.Sj.j,c=b.length,d=a.Sj,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.os=this.os;a.Vr.assign(this.Vr);a.wa=this.wa;a.fl=this.fl;a.wn=this.wn;a.xn=this.xn;a.Af=this.Af.J();a.Bf=this.Bf.J();a.Kl=this.Kl;a.Jl=this.Jl;a.cg=this.cg;return a};t=Fd.prototype;t.ia=function(){this.freeze();Object.freeze(this);return this};
t.freeze=function(){this.s=!0;var a=this.figures;a.freeze();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].freeze();return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;var a=this.figures;a.ka();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ka();return this};
t.Ta=function(a){if(!(a instanceof Fd))return!1;if(this.type!==a.type)return this.type===Id&&a.type===Gd?Jd(this,a):a.type===Id&&this.type===Gd?Jd(a,this):!1;if(this.type===Gd){var b=this.figures.j;a=a.figures.j;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Ta(a[d]))return!1;return!0}return K.C(this.startX,a.startX)&&K.C(this.startY,a.startY)&&K.C(this.endX,a.endX)&&K.C(this.endY,a.endY)};
function Jd(a,b){return a.type!==Id||b.type!==Gd?!1:1===b.figures.count&&(b=b.figures.O(0),1===b.segments.count&&K.C(a.startX,b.startX)&&K.C(a.startY,b.startY)&&(b=b.segments.O(0),b.type===Kd&&K.C(a.endX,b.endX)&&K.C(a.endY,b.endY)))?!0:!1}function Ld(a){return a.toString()}t.nb=function(a){a.classType===Fd?this.type=a:Ba(this,a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Id:return 0>a?"M"+this.startX.toString()+" "+this.startY.toString()+"L"+this.endX.toString()+" "+this.endY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a)+"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);case Md:var b=new L(this.startX,this.startY,0,0);b.ex(this.endX,this.endY,0,0);return 0>a?"M"+b.x.toString()+" "+b.y.toString()+"H"+b.right.toString()+"V"+b.bottom.toString()+"H"+b.left.toString()+"z":"M"+b.x.toFixed(a)+
" "+b.y.toFixed(a)+"H"+b.right.toFixed(a)+"V"+b.bottom.toFixed(a)+"H"+b.left.toFixed(a)+"z";case Nd:b=new L(this.startX,this.startY,0,0);b.ex(this.endX,this.endY,0,0);if(0>a)return a=b.left.toString()+" "+(b.y+b.height/2).toString(),"M"+a+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+(b.right.toString()+" "+(b.y+b.height/2).toString())+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+a;var c=b.left.toFixed(a)+" "+(b.y+b.height/2).toFixed(a);return"M"+c+"A"+(b.width/
2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+(b.right.toFixed(a)+" "+(b.y+b.height/2).toFixed(a))+"A"+(b.width/2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+c;case Gd:b="";c=this.figures.j;for(var d=c.length,e=0;e<d;e++){var f=c[e];0<e&&(b+=" x ");f.isFilled&&(b+="F ");b+=f.toString(a)}return b;default:return this.type.toString()}};
function Od(a,b){function c(){return u>=D-1?!0:null!==k[u+1].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/)}function d(){u++;return k[u]}function e(){var a=new J(parseFloat(d()),parseFloat(d()));w===w.toLowerCase()&&(a.x=B.x+a.x,a.y=B.y+a.y);return a}function f(){return B=e()}function g(){return z=e()}function h(){var a=y.toLowerCase();return"c"!==a&&"s"!==a&&"q"!==a&&"t"!==a?B:new J(2*B.x-z.x,2*B.y-z.y)}void 0===b&&(b=!1);"string"!==typeof a&&xa(a,"string",Fd,"parse:str");a=a.replace(/,/gm," ");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,
"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([^\s])/gm,"$1 $2");a=a.replace(/([^\s])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([0-9])([+\-])/gm,"$1 $2");a=a.replace(/[\s\r\t\n]+/gm," ");a=a.replace(/^\s+|\s+$/g,"");var k=a.split(" ");for(a=0;a<k.length;a++){var l=k[a];if(null!==l.match(/(\.[0-9]*)(\.)/gm)){for(var m=La(),n="",p=!1,r=0;r<l.length;r++){var q=l[r];"."!==q||p?"."===q?(m.push(n),
n="."):n+=q:(p=!0,n+=q)}m.push(n);k.splice(a,1);for(l=0;l<m.length;l++)k.splice(a+l,0,m[l]);a+=m.length-1;Oa(m)}}var u=-1,w="",y="";m=new J(0,0);var z=new J(0,0),B=new J(0,0),D=k.length;a=Wd(null);n=l=!1;p=!0;for(r=null;!(u>=D-1);)if(y=w,w=d(),""!==w)switch(w.toUpperCase()){case "X":p=!0;n=l=!1;break;case "M":r=f();null===a.nc||!0===p?(Xd(a,r.x,r.y,l,!n),p=!1):a.moveTo(r.x,r.y);for(m=B;!c();)r=f(),a.lineTo(r.x,r.y);break;case "L":for(;!c();)r=f(),a.lineTo(r.x,r.y);break;case "H":for(;!c();)B=new J((w===
w.toLowerCase()?B.x:0)+parseFloat(d()),B.y),a.lineTo(B.x,B.y);break;case "V":for(;!c();)B=new J(B.x,(w===w.toLowerCase()?B.y:0)+parseFloat(d())),a.lineTo(B.x,B.y);break;case "C":for(;!c();){r=e();q=g();var G=f();Yd(a,r.x,r.y,q.x,q.y,G.x,G.y)}break;case "S":for(;!c();)r=h(),q=g(),G=f(),Yd(a,r.x,r.y,q.x,q.y,G.x,G.y);break;case "Q":for(;!c();)r=g(),q=f(),Zd(a,r.x,r.y,q.x,q.y);break;case "T":for(;!c();)z=r=h(),q=f(),Zd(a,r.x,r.y,q.x,q.y);break;case "B":for(;!c();){r=parseFloat(d());q=parseFloat(d());
G=parseFloat(d());var O=parseFloat(d()),T=parseFloat(d()),P=T,ba=!1;c()||(P=parseFloat(d()),c()||(ba=0!==parseFloat(d())));w===w.toLowerCase()&&(G+=B.x,O+=B.y);a.arcTo(r,q,G,O,T,P,ba)}break;case "A":for(;!c();)r=Math.abs(parseFloat(d())),q=Math.abs(parseFloat(d())),G=parseFloat(d()),T=O=!1,ba=P=0,P=d(),1===P.length?(O=!!parseFloat(P),T=!!parseFloat(d()),P=parseFloat(d())):2===P.length?(O=!!parseFloat(P[0]),T=!!parseFloat(P[1]),P=parseFloat(d())):(O=!!parseFloat(P[0]),T=!!parseFloat(P[1]),P=parseFloat(P.slice(2))),
ba=parseFloat(d()),w===w.toLowerCase()&&(P=B.x+P,ba=B.y+ba),B.h(P,ba),$d(a,r,q,G,O,T,P,ba);break;case "Z":ae(a);B=m;break;case "F":r="";for(q=1;k[u+q];)if(null!==k[u+q].match(/[Uu]/))q++;else if(null===k[u+q].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))q++;else{r=k[u+q];break}r.match(/[Mm]/)?l=!0:0<a.nc.segments.length&&(a.nc.isFilled=!0);break;case "U":r="";for(q=1;k[u+q];)if(null!==k[u+q].match(/[Ff]/))q++;else if(null===k[u+q].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))q++;else{r=k[u+q];break}r.match(/[Mm]/)?
n=!0:a.vr(!1)}m=a.Yt;fe=a;if(b)for(b=m.figures.iterator;b.next();)b.value.isFilled=!0;return m}function ge(a,b){for(var c=a.length,d=J.alloc(),e=0;e<c;e++){var f=a[e];d.x=f[0];d.y=f[1];b.ya(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.ya(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.ya(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.ya(d);f[6]=d.x;f[7]=d.y}J.free(d)}t.tw=function(){if(this.wa||this.os!==this.figures.u)return!0;for(var a=this.figures.j,b=a.length,c=0;c<b;c++)if(a[c].tw())return!0;return!1};
Fd.prototype.computeBounds=function(){this.wa=!1;this.wn=this.fl=null;this.xn=NaN;this.os=this.figures.u;for(var a=this.figures.j,b=a.length,c=0;c<b;c++){var d=a[c];d.wa=!1;var e=d.segments;d.qt=e.u;d=e.j;e=d.length;for(var f=0;f<e;f++){var g=d[f];g.wa=!1;g.bf=null}}a=this.Vr;a.ka();isNaN(this.Kl)||isNaN(this.Jl)?a.h(0,0,0,0):a.h(0,0,this.Kl,this.Jl);he(this,a,!1);qc(a,0,0,0,0);a.freeze()};Fd.prototype.sy=function(){var a=new L;he(this,a,!0);return a};
function he(a,b,c){switch(a.type){case Id:case Md:case Nd:c?b.h(a.ed,a.fd,0,0):qc(b,a.ed,a.fd,0,0);qc(b,a.mc,a.sc,0,0);break;case Gd:var d=a.figures;a=d.j;d=d.length;for(var e=0;e<d;e++){var f=a[e];c&&0===e?b.h(f.startX,f.startY,0,0):qc(b,f.startX,f.startY,0,0);for(var g=f.segments.j,h=g.length,k=f.startX,l=f.startY,m=0;m<h;m++){var n=g[m];switch(n.type){case Kd:case ie:k=n.endX;l=n.endY;qc(b,k,l,0,0);break;case je:K.Cm(k,l,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;
break;case ke:K.Aw(k,l,n.point1X,n.point1Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;break;case le:case me:var p=n.type===le?ne(n,f):oe(n,f,k,l),r=p.length;if(0===r){k=n.centerX;l=n.centerY;qc(b,k,l,0,0);break}n=null;for(var q=0;q<r;q++)n=p[q],K.Cm(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.5,b);null!==n&&(k=n[6],l=n[7]);break;default:v("Unknown Segment type: "+n.type)}}}break;default:v("Unknown Geometry type: "+a.type)}}
Fd.prototype.normalize=function(){this.s&&va(this);var a=this.sy();this.offset(-a.x,-a.y);return new J(-a.x,-a.y)};Fd.prototype.offset=function(a,b){this.s&&va(this);F&&(C(a,Fd,"offset"),C(b,Fd,"offset"));this.transform(1,0,0,1,a,b);return this};Fd.prototype.scale=function(a,b){this.s&&va(this);F&&(C(a,Fd,"scale:x"),C(b,Fd,"scale:y"),0===a&&ya(a,"scale must be non-zero",Fd,"scale:x"),0===b&&ya(b,"scale must be non-zero",Fd,"scale:y"));this.transform(a,0,0,b,0,0);return this};
Fd.prototype.rotate=function(a,b,c){this.s&&va(this);void 0===b&&(b=0);void 0===c&&(c=0);F&&(C(a,Fd,"rotate:angle"),C(b,Fd,"rotate:x"),C(c,Fd,"rotate:y"));var d=Ib.alloc();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);Ib.free(d);return this};t=Fd.prototype;
t.transform=function(a,b,c,d,e,f){switch(this.type){case Id:case Md:case Nd:var g=this.ed;var h=this.fd;this.ed=g*a+h*c+e;this.fd=g*b+h*d+f;g=this.mc;h=this.sc;this.mc=g*a+h*c+e;this.sc=g*b+h*d+f;break;case Gd:for(var k=this.figures.j,l=k.length,m=0;m<l;m++){var n=k[m];g=n.startX;h=n.startY;n.startX=g*a+h*c+e;n.startY=g*b+h*d+f;n=n.segments.j;for(var p=n.length,r=0;r<p;r++){var q=n[r];switch(q.type){case Kd:case ie:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case je:g=q.point1X;h=q.point1Y;
q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.point2X;h=q.point2Y;q.point2X=g*a+h*c+e;q.point2Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case ke:g=q.point1X;h=q.point1Y;q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case le:g=q.centerX;h=q.centerY;q.centerX=g*a+h*c+e;q.centerY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.startAngle+=g);0>a&&(q.startAngle=180-q.startAngle,q.sweepAngle=-q.sweepAngle);0>d&&
(q.startAngle=-q.startAngle,q.sweepAngle=-q.sweepAngle);q.radiusX*=Math.sqrt(a*a+c*c);void 0!==q.radiusY&&(q.radiusY*=Math.sqrt(b*b+d*d));break;case me:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.xAxisRotation+=g);0>a&&(q.xAxisRotation=180-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);0>d&&(q.xAxisRotation=-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);q.radiusX*=Math.sqrt(a*a+c*c);q.radiusY*=Math.sqrt(b*b+d*d);break;default:v("Unknown Segment type: "+
q.type)}}}}this.wa=!0;return this};
t.fa=function(a,b){void 0===b&&(b=0);var c=this.ed,d=this.fd,e=this.mc,f=this.sc;switch(this.type){case Id:return K.Tb(c,d,e,f,b,a.x,a.y);case Md:var g=L.allocAt(Math.min(c,e)-b,Math.min(d,f)-b,Math.abs(e-c)+2*b,Math.abs(f-d)+2*b);a=g.fa(a);L.free(g);return a;case Nd:g=Math.min(c,e)-b;var h=Math.min(d,f)-b;c=(Math.abs(e-c)+2*b)/2;b=(Math.abs(f-d)+2*b)/2;if(0>=c||0>=b)return!1;g=a.x-(g+c);h=a.y-(h+b);return 1>=g*g/(c*c)+h*h/(b*b);case Gd:return pe(this,a,b,!0,!1);default:return!1}};
function pe(a,b,c,d,e){var f=b.x;b=b.y;for(var g=a.bounds.x-20,h=0,k,l,m,n,p=a.figures.j,r=p.length,q=0;q<r;q++){var u=p[q];if(u.isFilled){if(d&&u.fa(f,b,c))return!0;var w=u.segments;k=u.startX;l=u.startY;for(var y=k,z=l,B=w.j,D=0;D<=w.length;D++){var G=void 0;if(D!==w.length){G=B[D];var O=G.type;a=G.endX;n=G.endY}else O=Kd,a=y,n=z;switch(O){case ie:y=qe(f,b,g,b,k,l,y,z);if(isNaN(y))return!0;h+=y;y=a;z=n;break;case Kd:k=qe(f,b,g,b,k,l,a,n);if(isNaN(k))return!0;h+=k;break;case je:m=K.Iq(k,l,G.point1X,
G.point1Y,G.point2X,G.point2Y,a,n,g,b,f,b,.5);h+=m;break;case ke:m=K.Iq(k,l,(k+2*G.point1X)/3,(l+2*G.point1Y)/3,(2*G.point1X+a)/3,(2*G.point1Y+n)/3,a,n,g,b,f,b,.5);h+=m;break;case le:case me:O=G.type===le?ne(G,u):oe(G,u,k,l);var T=O.length;if(0===T){k=qe(f,b,g,b,k,l,G.centerX,G.centerY);if(isNaN(k))return!0;h+=k;break}G=null;for(var P=0;P<T;P++){G=O[P];if(0===P){m=qe(f,b,g,b,k,l,G[0],G[1]);if(isNaN(m))return!0;h+=m}m=K.Iq(G[0],G[1],G[2],G[3],G[4],G[5],G[6],G[7],g,b,f,b,.5);h+=m}null!==G&&(a=G[6],
n=G[7]);break;default:v("Unknown Segment type: "+G.type)}k=a;l=n}if(0!==h)return!0;h=0}else if(u.fa(f,b,e?c:c+2))return!0}return 0!==h}function qe(a,b,c,d,e,f,g,h){if(K.Tb(e,f,g,h,.05,a,b))return NaN;var k=(a-c)*(f-h);if(0===k)return 0;var l=((a*d-b*c)*(e-g)-(a-c)*(e*h-f*g))/k;b=(a*d-b*c)*(f-h)/k;if(l>=a)return 0;if((e>g?e-g:g-e)<(f>h?f-h:h-f))if(f<h){if(b<f||b>h)return 0}else{if(b<h||b>f)return 0}else if(e<g){if(l<e||l>g)return 0}else if(l<g||l>e)return 0;return 0<k?1:-1}
function re(a,b,c,d){a=a.figures.j;for(var e=a.length,f=0;f<e;f++)if(a[f].fa(b,c,d))return!0;return!1}
t.kw=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new J);if(this.type===Id)return b.h(this.startX+a*(this.endX-this.startX),this.startY+a*(this.endY-this.startY)),b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=f-g,d=0===m?0:d/m,c=c[h],h=c[2*a],e=c[2*a+1],b.h(h+(c[2*a+2]-h)*d,e+(c[2*a+3]-e)*d),b;g+=m}}return b};
t.Hy=function(a){0>a?a=0:1<a&&(a=1);if(this.type===Id)return 180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI;for(var b=this.flattenedSegments,c=this.flattenedLengths,d=b.length,e=this.flattenedTotalLength*a,f=0,g=0;g<d;g++){var h=c[g],k=h.length;for(a=0;a<k;a++){var l=h[a];if(f+l>=e)return e=b[g],b=e[2*a],c=e[2*a+1],d=e[2*a+2],a=e[2*a+3],1>Math.abs(d-b)&&1>Math.abs(a-c)?0:1>Math.abs(d-b)?0<=a-c?90:270:1>Math.abs(a-c)?0<=d-b?0:180:180*Math.atan2(a-c,d-b)/Math.PI;f+=l}}return NaN};
t.lw=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=[]);b.length=3;if(this.type===Id)return b[0]=this.startX+a*(this.endX-this.startX),b[1]=this.startY+a*(this.endY-this.startY),b[2]=180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI,b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=f-g,d=0===m?0:d/m,m=c[h],c=m[2*a],h=m[2*a+1],e=m[2*a+2],a=m[2*a+
3],b[0]=c+(e-c)*d,b[1]=h+(a-h)*d,b[2]=1>Math.abs(e-c)&&1>Math.abs(a-h)?0:1>Math.abs(e-c)?0<=a-h?90:270:1>Math.abs(a-h)?0<=e-c?0:180:180*Math.atan2(a-h,e-c)/Math.PI,b;g+=m}}return b};
t.Iy=function(a){if(this.type===Id){var b=this.startX,c=this.startY,d=this.endX,e=this.endY;if(b!==d||c!==e){var f=a.x;a=a.y;if(b===d){if(c<e){var g=c;d=e}else g=e,d=c;return a<=g?g===c?0:1:a>=d?d===c?0:1:Math.abs(a-c)/(d-g)}if(c===e)return b<d?g=b:(g=d,d=b),f<=g?g===b?0:1:f>=d?d===b?0:1:Math.abs(f-b)/(d-g);g=(d-b)*(d-b)+(e-c)*(e-c);var h=J.alloc();K.ai(b,c,d,e,f,a,h);a=h.x;f=h.y;J.free(h);return Math.sqrt(((a-b)*(a-b)+(f-c)*(f-c))/g)}}else if(this.type===Md){g=this.startX;h=this.startY;var k=this.endX;
e=this.endY;if(g!==k||h!==e){b=k-g;c=e-h;f=2*b+2*c;d=a.x;a=a.y;d=Math.min(Math.max(d,g),k);a=Math.min(Math.max(a,h),e);g=Math.abs(d-g);k=Math.abs(d-k);h=Math.abs(a-h);e=Math.abs(a-e);var l=Math.min(g,k,h,e);if(l===h)return d/f;if(l===k)return(b+a)/f;if(l===e)return(2*b+c-d)/f;if(l===g)return(2*b+2*c-a)/f}}else{b=this.flattenedSegments;c=this.flattenedLengths;f=this.flattenedTotalLength;d=J.alloc();e=Infinity;h=g=0;k=b.length;for(var m=l=0,n=0;n<k;n++)for(var p=b[n],r=c[n],q=p.length,u=0;u<q;u+=2){var w=
p[u],y=p[u+1];if(0!==u){K.ai(l,m,w,y,a.x,a.y,d);var z=(d.x-a.x)*(d.x-a.x)+(d.y-a.y)*(d.y-a.y);z<e&&(e=z,g=h,g+=Math.sqrt((d.x-l)*(d.x-l)+(d.y-m)*(d.y-m)));h+=r[(u-2)/2]}l=w;m=y}J.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0};
function se(a){if(null===a.fl){var b=a.fl=[],c=a.wn=[],d=[],e=[];if(a.type===Id)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.endY),b.push(d),e.push(Math.sqrt((a.startX-a.endX)*(a.startX-a.endX)+(a.startY-a.endY)*(a.startY-a.endY))),c.push(e);else if(a.type===Md)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.startY),d.push(a.endX),d.push(a.endY),d.push(a.startX),d.push(a.endY),d.push(a.startX),d.push(a.startY),b.push(d),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-
a.endY)),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-a.endY)),c.push(e);else if(a.type===Nd){var f=new te;f.startX=a.endX;f.startY=(a.startY+a.endY)/2;var g=new ue(le);g.startAngle=0;g.sweepAngle=360;g.centerX=(a.startX+a.endX)/2;g.centerY=(a.startY+a.endY)/2;g.radiusX=Math.abs(a.startX-a.endX)/2;g.radiusY=Math.abs(a.startY-a.endY)/2;f.add(g);a=ne(g,f);e=a.length;if(0===e)d.push(g.centerX),d.push(g.centerY);else{g=f.startX;f=f.startY;for(var h=0;h<e;h++){var k=a[h];K.Pe(g,f,k[2],k[3],
k[4],k[5],k[6],k[7],.5,d);g=k[6];f=k[7]}}b.push(d);c.push(ve(d))}else for(a=a.figures.iterator;a.next();){e=a.value;d=[];d.push(e.startX);d.push(e.startY);g=e.startX;f=e.startY;h=g;k=f;for(var l=e.segments.j,m=l.length,n=0;n<m;n++){var p=l[n];switch(p.type){case ie:4<=d.length&&(b.push(d),c.push(ve(d)));d=[];d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;h=g;k=f;break;case Kd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case je:K.Pe(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,
.5,d);g=p.endX;f=p.endY;break;case ke:K.jr(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case le:var r=ne(p,e),q=r.length;if(0===q){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(var u=0;u<q;u++){var w=r[u];K.Pe(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.5,d);g=w[6];f=w[7]}break;case me:r=oe(p,e,g,f);q=r.length;if(0===q){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(u=0;u<q;u++)w=r[u],K.Pe(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.5,d),g=w[6],
f=w[7];break;default:v("Segment not of valid type: "+p.type)}p.isClosed&&(d.push(h),d.push(k))}4<=d.length&&(b.push(d),c.push(ve(d)))}}}function ve(a){for(var b=[],c=0,d=0,e=a.length,f=0;f<e;f+=2){var g=a[f],h=a[f+1];0!==f&&(c=Math.sqrt(Lb(c,d,g,h)),b.push(c));c=g;d=h}return b}t.add=function(a){this.Sj.add(a);return this};t.ln=function(a,b,c,d,e,f,g,h){this.s&&va(this);this.Af=(new M(a,b,e,f)).freeze();this.Bf=(new M(c,d,g,h)).freeze();return this};
ma.Object.defineProperties(Fd.prototype,{flattenedSegments:{configurable:!0,get:function(){se(this);return this.fl}},flattenedLengths:{configurable:!0,get:function(){se(this);return this.wn}},flattenedTotalLength:{configurable:!0,get:function(){var a=this.xn;if(isNaN(a)){if(this.type===Id){a=Math.abs(this.endX-this.startX);var b=Math.abs(this.endY-this.startY);a=Math.sqrt(a*a+b*b)}else if(this.type===Md)a=2*Math.abs(this.endX-this.startX)+2*Math.abs(this.endY-
this.startY);else{b=this.flattenedLengths;for(var c=b.length,d=a=0;d<c;d++)for(var e=b[d],f=e.length,g=0;g<f;g++)a+=e[g]}this.xn=a}return a}},type:{configurable:!0,get:function(){return this.sa},set:function(a){this.sa!==a&&(F&&hb(a,Fd,Fd,"type"),this.s&&va(this,a),this.sa=a,this.wa=!0)}},startX:{configurable:!0,get:function(){return this.ed},set:function(a){this.ed!==a&&(F&&C(a,Fd,"startX"),this.s&&va(this,a),this.ed=a,this.wa=!0)}},startY:{configurable:!0,
get:function(){return this.fd},set:function(a){this.fd!==a&&(F&&C(a,Fd,"startY"),this.s&&va(this,a),this.fd=a,this.wa=!0)}},endX:{configurable:!0,get:function(){return this.mc},set:function(a){this.mc!==a&&(F&&C(a,Fd,"endX"),this.s&&va(this,a),this.mc=a,this.wa=!0)}},endY:{configurable:!0,get:function(){return this.sc},set:function(a){this.sc!==a&&(F&&C(a,Fd,"endY"),this.s&&va(this,a),this.sc=a,this.wa=!0)}},figures:{configurable:!0,get:function(){return this.Sj},
set:function(a){this.Sj!==a&&(F&&x(a,H,Fd,"figures"),this.s&&va(this,a),this.Sj=a,this.wa=!0)}},spot1:{configurable:!0,get:function(){return this.Af},set:function(a){F&&x(a,M,Fd,"spot1");this.s&&va(this,a);this.Af=a.J()}},spot2:{configurable:!0,get:function(){return this.Bf},set:function(a){F&&x(a,M,Fd,"spot2");this.s&&va(this,a);this.Bf=a.J()}},defaultStretch:{configurable:!0,get:function(){return this.cg},set:function(a){F&&hb(a,N,Fd,"stretch");this.s&&
va(this,a);this.cg=a}},bounds:{configurable:!0,get:function(){this.tw()&&this.computeBounds();return this.Vr}}});Fd.prototype.setSpots=Fd.prototype.ln;Fd.prototype.add=Fd.prototype.add;Fd.prototype.getFractionForPoint=Fd.prototype.Iy;Fd.prototype.getPointAndAngleAlongPath=Fd.prototype.lw;Fd.prototype.getAngleAlongPath=Fd.prototype.Hy;Fd.prototype.getPointAlongPath=Fd.prototype.kw;Fd.prototype.containsPoint=Fd.prototype.fa;Fd.prototype.transform=Fd.prototype.transform;
Fd.prototype.rotate=Fd.prototype.rotate;Fd.prototype.scale=Fd.prototype.scale;Fd.prototype.offset=Fd.prototype.offset;Fd.prototype.normalize=Fd.prototype.normalize;Fd.prototype.computeBoundsWithoutOrigin=Fd.prototype.sy;Fd.prototype.equalsApprox=Fd.prototype.Ta;var Id=new E(Fd,"Line",0),Md=new E(Fd,"Rectangle",1),Nd=new E(Fd,"Ellipse",2),Gd=new E(Fd,"Path",3);Fd.className="Geometry";Fd.stringify=Ld;
Fd.fillPath=function(a){"string"!==typeof a&&xa(a,"string",Fd,"fillPath:str");a=a.split(/[Xx]/);for(var b=a.length,c="",d=0;d<b;d++){var e=a[d];c=null!==e.match(/[Ff]/)?0===d?c+e:c+("X"+(" "===e[0]?"":" ")+e):c+((0===d?"":"X ")+"F"+(" "===e[0]?"":" ")+e)}return c};Fd.parse=Od;Fd.Line=Id;Fd.Rectangle=Md;Fd.Ellipse=Nd;Fd.Path=Gd;
function te(a,b,c,d){fb(this);this.s=!1;void 0===c&&(c=!0);this.ys=c;void 0===d&&(d=!0);this.Ds=d;void 0!==a?(F&&C(a,te,"sx"),this.ed=a):this.ed=0;void 0!==b?(F&&C(b,te,"sy"),this.fd=b):this.fd=0;this.km=new H;this.qt=this.km.u;this.wa=!0}te.prototype.copy=function(){var a=new te;a.ys=this.ys;a.Ds=this.Ds;a.ed=this.ed;a.fd=this.fd;for(var b=this.km.j,c=b.length,d=a.km,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.qt=this.qt;a.wa=this.wa;return a};t=te.prototype;
t.Ta=function(a){if(!(a instanceof te&&K.C(this.startX,a.startX)&&K.C(this.startY,a.startY)))return!1;var b=this.segments.j;a=a.segments.j;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Ta(a[d]))return!1;return!0};t.toString=function(a){void 0===a&&(a=-1);var b=0>a?"M"+this.startX.toString()+" "+this.startY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a);for(var c=this.segments.j,d=c.length,e=0;e<d;e++)b+=" "+c[e].toString(a);return b};
t.freeze=function(){this.s=!0;var a=this.segments;a.freeze();var b=a.j;a=a.length;for(var c=0;c<a;c++)b[c].freeze();return this};t.ka=function(){this.s=!1;var a=this.segments;a.ka();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ka();return this};t.tw=function(){if(this.wa)return!0;var a=this.segments;if(this.qt!==a.u)return!0;a=a.j;for(var b=a.length,c=0;c<b;c++)if(a[c].wa)return!0;return!1};t.add=function(a){this.km.add(a);return this};
t.fa=function(a,b,c){for(var d=this.startX,e=this.startY,f=d,g=e,h=this.segments.j,k=h.length,l=0;l<k;l++){var m=h[l];switch(m.type){case ie:f=m.endX;g=m.endY;d=m.endX;e=m.endY;break;case Kd:if(K.Tb(d,e,m.endX,m.endY,c,a,b))return!0;d=m.endX;e=m.endY;break;case je:if(K.Lt(d,e,m.point1X,m.point1Y,m.point2X,m.point2Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case ke:if(K.Bw(d,e,m.point1X,m.point1Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case le:case me:var n=m.type===
le?ne(m,this):oe(m,this,d,e),p=n.length;if(0===p){if(K.Tb(d,e,m.centerX,m.centerY,c,a,b))return!0;d=m.centerX;e=m.centerY;break}for(var r=null,q=0;q<p;q++)if(r=n[q],0===q&&K.Tb(d,e,r[0],r[1],c,a,b)||K.Lt(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],.5,a,b,c))return!0;null!==r&&(d=r[6],e=r[7]);break;default:v("Unknown Segment type: "+m.type)}if(m.isClosed&&(d!==f||e!==g)&&K.Tb(d,e,f,g,c,a,b))return!0}return!1};
ma.Object.defineProperties(te.prototype,{isFilled:{configurable:!0,get:function(){return this.ys},set:function(a){F&&A(a,"boolean",te,"isFilled");this.s&&va(this,a);this.ys=a}},isShadowed:{configurable:!0,get:function(){return this.Ds},set:function(a){F&&A(a,"boolean",te,"isShadowed");this.s&&va(this,a);this.Ds=a}},startX:{configurable:!0,get:function(){return this.ed},set:function(a){F&&C(a,te,"startX");this.s&&va(this,a);this.ed=a;this.wa=!0}},startY:{configurable:!0,
enumerable:!0,get:function(){return this.fd},set:function(a){F&&C(a,te,"startY");this.s&&va(this,a);this.fd=a;this.wa=!0}},segments:{configurable:!0,get:function(){return this.km},set:function(a){F&&x(a,H,te,"segments");this.s&&va(this,a);this.km=a;this.wa=!0}}});te.prototype.add=te.prototype.add;te.prototype.equalsApprox=te.prototype.Ta;te.className="PathFigure";
function ue(a,b,c,d,e,f,g,h){fb(this);this.s=!1;void 0===a?a=Kd:F&&hb(a,ue,ue,"constructor:type");this.sa=a;void 0!==b?(F&&C(b,ue,"ex"),this.mc=b):this.mc=0;void 0!==c?(F&&C(c,ue,"ey"),this.sc=c):this.sc=0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===f&&(f=0);void 0===g&&(g=0);a===me?(a=f%360,0>a&&(a+=360),this.Je=a,this.aj=0,F&&C(d,ue,"x1"),this.bj=Math.max(d,0),F&&C(e,ue,"y1"),this.Ah=Math.max(e,0),this.Sl="boolean"===typeof g?g:"number"===typeof g?!!g:!1,this.jl=!!h):(F&&C(d,ue,"x1"),this.Je=d,
F&&C(e,ue,"y1"),this.aj=e,F&&C(f,ue,"x2"),a===le&&(f=Math.max(f,0)),this.bj=f,"number"===typeof g?(a===le&&(g=Math.max(g,0)),this.Ah=g):this.Ah=0,this.jl=this.Sl=!1);this.Xj=!1;this.wa=!0;this.bf=null}ue.prototype.copy=function(){var a=new ue;a.sa=this.sa;a.mc=this.mc;a.sc=this.sc;a.Je=this.Je;a.aj=this.aj;a.bj=this.bj;a.Ah=this.Ah;a.Sl=this.Sl;a.jl=this.jl;a.Xj=this.Xj;a.wa=this.wa;return a};t=ue.prototype;
t.Ta=function(a){if(!(a instanceof ue)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case ie:case Kd:return K.C(this.endX,a.endX)&&K.C(this.endY,a.endY);case je:return K.C(this.endX,a.endX)&&K.C(this.endY,a.endY)&&K.C(this.point1X,a.point1X)&&K.C(this.point1Y,a.point1Y)&&K.C(this.point2X,a.point2X)&&K.C(this.point2Y,a.point2Y);case ke:return K.C(this.endX,a.endX)&&K.C(this.endY,a.endY)&&K.C(this.point1X,a.point1X)&&K.C(this.point1Y,a.point1Y);case le:return K.C(this.startAngle,
a.startAngle)&&K.C(this.sweepAngle,a.sweepAngle)&&K.C(this.centerX,a.centerX)&&K.C(this.centerY,a.centerY)&&K.C(this.radiusX,a.radiusX)&&K.C(this.radiusY,a.radiusY);case me:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&K.C(this.xAxisRotation,a.xAxisRotation)&&K.C(this.endX,a.endX)&&K.C(this.endY,a.endY)&&K.C(this.radiusX,a.radiusX)&&K.C(this.radiusY,a.radiusY);default:return!1}};t.nb=function(a){a.classType===ue?this.type=a:Ba(this,a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case ie:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Kd:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case je:a=0>a?"C"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.point2X.toString()+" "+this.point2Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"C"+this.point1X.toFixed(a)+
" "+this.point1Y.toFixed(a)+" "+this.point2X.toFixed(a)+" "+this.point2Y.toFixed(a)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case ke:a=0>a?"Q"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"Q"+this.point1X.toFixed(a)+" "+this.point1Y.toFixed(a)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case le:a=0>a?"B"+this.startAngle.toString()+" "+this.sweepAngle.toString()+" "+this.centerX.toString()+" "+this.centerY.toString()+
" "+this.radiusX.toString()+" "+this.radiusY.toString():"B"+this.startAngle.toFixed(a)+" "+this.sweepAngle.toFixed(a)+" "+this.centerX.toFixed(a)+" "+this.centerY.toFixed(a)+" "+this.radiusX.toFixed(a)+" "+this.radiusY.toFixed(a);break;case me:a=0>a?"A"+this.radiusX.toString()+" "+this.radiusY.toString()+" "+this.xAxisRotation.toString()+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toString()+" "+this.endY.toString():"A"+this.radiusX.toFixed(a)+" "+this.radiusY.toFixed(a)+
" "+this.xAxisRotation.toFixed(a)+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;default:a=this.type.toString()}return a+(this.Xj?"z":"")};t.freeze=function(){this.s=!0;return this};t.ka=function(){this.s=!1;return this};t.close=function(){this.Xj=!0;return this};
function ne(a,b){if(null!==a.bf&&!1===b.wa)return a.bf;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.bf=[],a.bf;b=a.Je;var e=a.aj,f=K.ty(0,0,c<d?c:d,a.startAngle,a.startAngle+a.sweepAngle,!1);if(c!==d){var g=Ib.alloc();g.reset();c<d?g.scale(1,d/c):g.scale(c/d,1);ge(f,g);Ib.free(g)}c=f.length;for(d=0;d<c;d++)g=f[d],g[0]+=b,g[1]+=e,g[2]+=b,g[3]+=e,g[4]+=b,g[5]+=e,g[6]+=b,g[7]+=e;a.bf=f;return a.bf}
function oe(a,b,c,d){function e(a,b,c,d){return(a*d<b*c?-1:1)*Math.acos((a*c+b*d)/(Math.sqrt(a*a+b*b)*Math.sqrt(c*c+d*d)))}if(null!==a.bf&&!1===b.wa)return a.bf;b=a.bj;var f=a.Ah;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.Je,h=a.Sl,k=a.jl,l=a.mc,m=a.sc,n=Math.cos(g),p=Math.sin(g),r=n*(c-l)/2+p*(d-m)/2;g=-p*(c-l)/2+n*(d-m)/2;var q=r*r/(b*b)+g*g/(f*f);1<q&&(b*=Math.sqrt(q),f*=Math.sqrt(q));q=(h===k?-1:1)*Math.sqrt((b*b*f*f-b*b*g*g-f*f*r*r)/(b*b*g*g+f*f*r*r));isNaN(q)&&(q=0);h=q*b*g/f;q=q*-f*
r/b;isNaN(h)&&(h=0);isNaN(q)&&(q=0);c=(c+l)/2+n*h-p*q;d=(d+m)/2+p*h+n*q;m=e(1,0,(r-h)/b,(g-q)/f);n=(r-h)/b;l=(g-q)/f;r=(-r-h)/b;h=(-g-q)/f;g=e(n,l,r,h);r=(n*r+l*h)/(Math.sqrt(n*n+l*l)*Math.sqrt(r*r+h*h));-1>=r?g=Math.PI:1<=r&&(g=0);!k&&0<g&&(g-=2*Math.PI);k&&0>g&&(g+=2*Math.PI);k=b>f?1:b/f;r=b>f?f/b:1;b=K.ty(0,0,b>f?b:f,m,m+g,!0);f=Ib.alloc();f.reset();f.translate(c,d);f.rotate(a.Je,0,0);f.scale(k,r);ge(b,f);Ib.free(f);a.bf=b;return a.bf}
ma.Object.defineProperties(ue.prototype,{isClosed:{configurable:!0,get:function(){return this.Xj},set:function(a){this.Xj!==a&&(this.Xj=a,this.wa=!0)}},type:{configurable:!0,get:function(){return this.sa},set:function(a){F&&hb(a,ue,ue,"type");this.s&&va(this,a);this.sa=a;this.wa=!0}},endX:{configurable:!0,get:function(){return this.mc},set:function(a){F&&C(a,ue,"endX");this.s&&va(this,a);this.mc=a;this.wa=!0}},endY:{configurable:!0,get:function(){return this.sc},
set:function(a){F&&C(a,ue,"endY");this.s&&va(this,a);this.sc=a;this.wa=!0}},point1X:{configurable:!0,get:function(){return this.Je},set:function(a){F&&C(a,ue,"point1X");this.s&&va(this,a);this.Je=a;this.wa=!0}},point1Y:{configurable:!0,get:function(){return this.aj},set:function(a){F&&C(a,ue,"point1Y");this.s&&va(this,a);this.aj=a;this.wa=!0}},point2X:{configurable:!0,get:function(){return this.bj},set:function(a){F&&C(a,ue,"point2X");this.s&&va(this,a);this.bj=
a;this.wa=!0}},point2Y:{configurable:!0,get:function(){return this.Ah},set:function(a){F&&C(a,ue,"point2Y");this.s&&va(this,a);this.Ah=a;this.wa=!0}},centerX:{configurable:!0,get:function(){return this.Je},set:function(a){F&&C(a,ue,"centerX");this.s&&va(this,a);this.Je=a;this.wa=!0}},centerY:{configurable:!0,get:function(){return this.aj},set:function(a){F&&C(a,ue,"centerY");this.s&&va(this,a);this.aj=a;this.wa=!0}},radiusX:{configurable:!0,
get:function(){return this.bj},set:function(a){F&&C(a,ue,"radiusX");0>a&&ya(a,">= zero",ue,"radiusX");this.s&&va(this,a);this.bj=a;this.wa=!0}},radiusY:{configurable:!0,get:function(){return this.Ah},set:function(a){F&&C(a,ue,"radiusY");0>a&&ya(a,">= zero",ue,"radiusY");this.s&&va(this,a);this.Ah=a;this.wa=!0}},startAngle:{configurable:!0,get:function(){return this.mc},set:function(a){this.mc!==a&&(this.s&&va(this,a),F&&C(a,ue,"startAngle"),a%=360,0>a&&(a+=360),this.mc=
a,this.wa=!0)}},sweepAngle:{configurable:!0,get:function(){return this.sc},set:function(a){F&&C(a,ue,"sweepAngle");this.s&&va(this,a);360<a&&(a=360);-360>a&&(a=-360);this.sc=a;this.wa=!0}},isClockwiseArc:{configurable:!0,get:function(){return this.jl},set:function(a){this.s&&va(this,a);this.jl=a;this.wa=!0}},isLargeArc:{configurable:!0,get:function(){return this.Sl},set:function(a){this.s&&va(this,a);this.Sl=a;this.wa=!0}},xAxisRotation:{configurable:!0,
get:function(){return this.Je},set:function(a){F&&C(a,ue,"xAxisRotation");a%=360;0>a&&(a+=360);this.s&&va(this,a);this.Je=a;this.wa=!0}}});ue.prototype.equalsApprox=ue.prototype.Ta;var ie=new E(ue,"Move",0),Kd=new E(ue,"Line",1),je=new E(ue,"Bezier",2),ke=new E(ue,"QuadraticBezier",3),le=new E(ue,"Arc",4),me=new E(ue,"SvgArc",4);ue.className="PathSegment";ue.Move=ie;ue.Line=Kd;ue.Bezier=je;ue.QuadraticBezier=ke;ue.Arc=le;ue.SvgArc=me;
function we(){this.B=null;this.Lv=(new J(0,0)).freeze();this.Uu=(new J(0,0)).freeze();this.Nr=this.Os=0;this.Or=1;this.Ni="";this.Ft=this.hs=!1;this.es=this.Qr=0;this.ah=this.rs=this.Bs=!1;this.ns=null;this.At=0;this.pd=this.zt=null}we.prototype.copy=function(){var a=new we;return this.clone(a)};
we.prototype.clone=function(a){a.B=this.B;a.Lv.assign(this.viewPoint);a.Uu.assign(this.documentPoint);a.Os=this.Os;a.Nr=this.Nr;a.Or=this.Or;a.Ni=this.Ni;a.hs=this.hs;a.Ft=this.Ft;a.Qr=this.Qr;a.es=this.es;a.Bs=this.Bs;a.rs=this.rs;a.ah=this.ah;a.ns=this.ns;a.At=this.At;a.zt=this.zt;a.pd=this.pd;return a};
we.prototype.toString=function(){var a="^";0!==this.modifiers&&(a+="M:"+this.modifiers);0!==this.button&&(a+="B:"+this.button);""!==this.key&&(a+="K:"+this.key);0!==this.clickCount&&(a+="C:"+this.clickCount);0!==this.delta&&(a+="D:"+this.delta);this.handled&&(a+="h");this.bubbles&&(a+="b");null!==this.documentPoint&&(a+="@"+this.documentPoint.toString());return a};we.prototype.Uq=function(a,b){var c=this.diagram;if(null===c)return b;xe(c,this.event,a,b);return b};
we.prototype.BA=function(a,b){var c=this.diagram;if(null===c)return b;xe(c,this.event,a,b);b.assign(c.Au(b));return b};
ma.Object.defineProperties(we.prototype,{diagram:{configurable:!0,get:function(){return this.B},set:function(a){this.B=a}},viewPoint:{configurable:!0,get:function(){return this.Lv},set:function(a){x(a,J,we,"viewPoint");this.Lv.assign(a)}},documentPoint:{configurable:!0,get:function(){return this.Uu},set:function(a){x(a,J,we,"documentPoint");this.Uu.assign(a)}},modifiers:{configurable:!0,get:function(){return this.Os},set:function(a){this.Os=
a}},button:{configurable:!0,get:function(){return this.Nr},set:function(a){this.Nr=a;if(null===this.event)switch(a){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2}}},buttons:{configurable:!0,get:function(){return this.Or},set:function(a){this.Or=a}},key:{configurable:!0,get:function(){return this.Ni},set:function(a){this.Ni=a}},down:{configurable:!0,get:function(){return this.hs},set:function(a){this.hs=a}},up:{configurable:!0,
enumerable:!0,get:function(){return this.Ft},set:function(a){this.Ft=a}},clickCount:{configurable:!0,get:function(){return this.Qr},set:function(a){this.Qr=a}},delta:{configurable:!0,get:function(){return this.es},set:function(a){this.es=a}},isMultiTouch:{configurable:!0,get:function(){return this.Bs},set:function(a){this.Bs=a}},handled:{configurable:!0,get:function(){return this.rs},set:function(a){this.rs=a}},bubbles:{configurable:!0,
get:function(){return this.ah},set:function(a){this.ah=a}},event:{configurable:!0,get:function(){return this.ns},set:function(a){this.ns=a}},isTouchEvent:{configurable:!0,get:function(){var a=qa.TouchEvent,b=this.event;return a&&b instanceof a?!0:(a=qa.PointerEvent)&&b instanceof a&&("touch"===b.pointerType||"pen"===b.pointerType)}},timestamp:{configurable:!0,get:function(){return this.At},set:function(a){this.At=a}},targetDiagram:{configurable:!0,
get:function(){return this.zt},set:function(a){this.zt=a}},targetObject:{configurable:!0,get:function(){return this.pd},set:function(a){this.pd=a}},control:{configurable:!0,get:function(){return 0!==(this.modifiers&1)},set:function(a){this.modifiers=a?this.modifiers|1:this.modifiers&-2}},shift:{configurable:!0,get:function(){return 0!==(this.modifiers&4)},set:function(a){this.modifiers=a?this.modifiers|4:this.modifiers&-5}},alt:{configurable:!0,
get:function(){return 0!==(this.modifiers&2)},set:function(a){this.modifiers=a?this.modifiers|2:this.modifiers&-3}},meta:{configurable:!0,get:function(){return 0!==(this.modifiers&8)},set:function(a){this.modifiers=a?this.modifiers|8:this.modifiers&-9}},left:{configurable:!0,get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&1):0===this.button},set:function(a){this.buttons=
a?this.buttons|1:this.buttons&-2}},right:{configurable:!0,get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&2):2===this.button},set:function(a){this.buttons=a?this.buttons|2:this.buttons&-3}},middle:{configurable:!0,get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&
4):1===this.button},set:function(a){this.buttons=a?this.buttons|4:this.buttons&-5}}});we.prototype.getMultiTouchDocumentPoint=we.prototype.BA;we.prototype.getMultiTouchViewPoint=we.prototype.Uq;we.className="InputEvent";function ye(){this.B=null;this.Wa="";this.Ys=this.xt=null}ye.prototype.copy=function(){var a=new ye;a.B=this.B;a.Wa=this.Wa;a.xt=this.xt;a.Ys=this.Ys;return a};
ye.prototype.toString=function(){var a="*"+this.name;null!==this.subject&&(a+=":"+this.subject.toString());null!==this.parameter&&(a+="("+this.parameter.toString()+")");return a};
ma.Object.defineProperties(ye.prototype,{diagram:{configurable:!0,get:function(){return this.B},set:function(a){this.B=a}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){this.Wa=a}},subject:{configurable:!0,get:function(){return this.xt},set:function(a){this.xt=a}},parameter:{configurable:!0,get:function(){return this.Ys},set:function(a){this.Ys=a}}});ye.className="DiagramEvent";
function Ge(){this.In=He;this.tf=this.Ns="";this.qp=this.rp=this.yp=this.zp=this.xp=this.B=this.gc=null}Ge.prototype.clear=function(){this.qp=this.rp=this.yp=this.zp=this.xp=this.B=this.gc=null};
Ge.prototype.copy=function(){var a=new Ge;a.In=this.In;a.Ns=this.Ns;a.tf=this.tf;a.gc=this.gc;a.B=this.B;a.xp=this.xp;var b=this.zp;a.zp=Fa(b)&&"function"===typeof b.J?b.J():b;b=this.yp;a.yp=Fa(b)&&"function"===typeof b.J?b.J():b;b=this.rp;a.rp=Fa(b)&&"function"===typeof b.J?b.J():b;b=this.qp;a.qp=Fa(b)&&"function"===typeof b.J?b.J():b;return a};Ge.prototype.nb=function(a){a.classType===Ge?this.change=a:Ba(this,a)};
Ge.prototype.toString=function(){var a="";a=this.change===Ie?a+"* ":this.change===He?a+(null!==this.model?"!m":"!d"):a+((null!==this.model?"!m":"!d")+this.change);this.propertyName&&"string"===typeof this.propertyName&&(a+=" "+this.propertyName);this.modelChange&&this.modelChange!==this.propertyName&&(a+=" "+this.modelChange);a+=": ";this.change===Ie?null!==this.oldValue&&(a+=" "+this.oldValue):(null!==this.object&&(a+=Qa(this.object)),null!==this.oldValue&&(a+="  old: "+Qa(this.oldValue)),null!==
this.oldParam&&(a+=" "+this.oldParam),null!==this.newValue&&(a+="  new: "+Qa(this.newValue)),null!==this.newParam&&(a+=" "+this.newParam));return a};Ge.prototype.K=function(a){return a?this.oldValue:this.newValue};Ge.prototype.DA=function(a){return a?this.oldParam:this.newParam};Ge.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1};
Ge.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.changeState(this,!0):null!==this.diagram&&this.diagram.changeState(this,!0))};Ge.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};Ge.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.changeState(this,!1):null!==this.diagram&&this.diagram.changeState(this,!1))};
ma.Object.defineProperties(Ge.prototype,{model:{configurable:!0,get:function(){return this.gc},set:function(a){this.gc=a}},diagram:{configurable:!0,get:function(){return this.B},set:function(a){this.B=a}},change:{configurable:!0,get:function(){return this.In},set:function(a){F&&hb(a,Ge,Ge,"change");this.In=a}},modelChange:{configurable:!0,get:function(){return this.Ns},set:function(a){F&&A(a,"string",Ge,"modelChange");this.Ns=a}},propertyName:{configurable:!0,
enumerable:!0,get:function(){return this.tf},set:function(a){F&&"string"!==typeof a&&A(a,"function",Ge,"propertyName");this.tf=a}},isTransactionFinished:{configurable:!0,get:function(){return this.In===Ie&&("CommittedTransaction"===this.tf||"FinishedUndo"===this.tf||"FinishedRedo"===this.tf)}},object:{configurable:!0,get:function(){return this.xp},set:function(a){this.xp=a}},oldValue:{configurable:!0,get:function(){return this.zp},set:function(a){this.zp=
a}},oldParam:{configurable:!0,get:function(){return this.yp},set:function(a){this.yp=a}},newValue:{configurable:!0,get:function(){return this.rp},set:function(a){this.rp=a}},newParam:{configurable:!0,get:function(){return this.qp},set:function(a){this.qp=a}}});Ge.prototype.redo=Ge.prototype.redo;Ge.prototype.canRedo=Ge.prototype.canRedo;Ge.prototype.undo=Ge.prototype.undo;Ge.prototype.canUndo=Ge.prototype.canUndo;Ge.prototype.getParam=Ge.prototype.DA;
Ge.prototype.getValue=Ge.prototype.K;Ge.prototype.clear=Ge.prototype.clear;var Ie=new E(Ge,"Transaction",-1),He=new E(Ge,"Property",0),Je=new E(Ge,"Insert",1),Ke=new E(Ge,"Remove",2);Ge.className="ChangedEvent";Ge.Transaction=Ie;Ge.Property=He;Ge.Insert=Je;Ge.Remove=Ke;function Le(){this.w=(new H).freeze();this.Wa="";this.l=!1}
Le.prototype.toString=function(a){var b="Transaction: "+this.name+" "+this.changes.count.toString()+(this.isComplete?"":", incomplete");if(void 0!==a&&0<a){a=this.changes.count;for(var c=0;c<a;c++){var d=this.changes.O(c);null!==d&&(b+="\n  "+d.toString())}}return b};Le.prototype.clear=function(){var a=this.changes;a.ka();for(var b=a.count-1;0<=b;b--){var c=a.O(b);null!==c&&c.clear()}a.clear();a.freeze()};Le.prototype.canUndo=function(){return this.isComplete};
Le.prototype.undo=function(){if(this.canUndo())for(var a=this.changes.count-1;0<=a;a--){var b=this.changes.O(a);null!==b&&b.undo()}};Le.prototype.canRedo=function(){return this.isComplete};Le.prototype.redo=function(){if(this.canRedo())for(var a=this.changes.count,b=0;b<a;b++){var c=this.changes.O(b);null!==c&&c.redo()}};
ma.Object.defineProperties(Le.prototype,{changes:{configurable:!0,get:function(){return this.w}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){this.Wa=a}},isComplete:{configurable:!0,get:function(){return this.l},set:function(a){this.l=a}}});Le.prototype.redo=Le.prototype.redo;Le.prototype.canRedo=Le.prototype.canRedo;Le.prototype.undo=Le.prototype.undo;Le.prototype.canUndo=Le.prototype.canUndo;Le.prototype.clear=Le.prototype.clear;
Le.className="Transaction";function Me(){this.sv=new I;this.nd=!1;this.L=(new H).freeze();this.Vd=-1;this.w=999;this.ye=!1;this.bs=null;this.ij=0;this.l=!1;F&&(this.l=!0);this.Fe=(new H).freeze();this.$l=new H;this.av=!0;this.hv=this.zs=this.lv=this.kv=!1}
Me.prototype.toString=function(a){var b="UndoManager "+this.historyIndex+"<"+this.history.count+"<="+this.maxHistoryLength;b+="[";for(var c=this.nestedTransactionNames.count,d=0;d<c;d++)0<d&&(b+=" "),b+=this.nestedTransactionNames.O(d);b+="]";if(void 0!==a&&0<a)for(c=this.history.count,d=0;d<c;d++)b+="\n "+this.history.O(d).toString(a-1);return b};
Me.prototype.clear=function(){var a=this.history;a.ka();for(var b=a.count-1;0<=b;b--){var c=a.O(b);null!==c&&c.clear()}a.clear();this.Vd=-1;a.freeze();this.ye=!1;this.bs=null;this.ij=0;this.Fe.ka();this.Fe.clear();this.Fe.freeze();this.$l.clear();this.hv=this.zs=this.lv=this.kv=!1};Me.prototype.copyProperties=function(a){this.isEnabled=a.isEnabled;this.maxHistoryLength=a.maxHistoryLength;this.checksTransactionLevel=a.checksTransactionLevel};t=Me.prototype;t.ky=function(a){this.sv.add(a)};t.bz=function(a){this.sv.remove(a)};
t.Ca=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.av&&(this.av=!1,this.ij++,this.isInternalTransaction||this.Gb("StartingFirstTransaction",a,this.currentTransaction),0<this.ij&&this.ij--);this.isEnabled&&(this.Fe.ka(),this.Fe.add(a),this.Fe.freeze(),null===this.currentTransaction?this.$l.add(0):this.$l.add(this.currentTransaction.changes.count));this.ij++;var b=1===this.transactionLevel;b&&(this.isInternalTransaction||this.Gb("StartedTransaction",a,this.currentTransaction));
return b};t.bb=function(a){void 0===a&&(a="");return Ne(this,!0,a)};t.Tf=function(){return Ne(this,!1,"")};
function Ne(a,b,c){if(a.isUndoingRedoing)return!1;a.checksTransactionLevel&&1>a.transactionLevel&&Ca("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel,e=a.currentTransaction;d&&b&&(a.isInternalTransaction||a.Gb("CommittingTransaction",c,e));var f=0;if(0<a.transactionLevel&&(a.ij--,a.isEnabled)){var g=a.Fe.count;0<g&&(""===c&&(c=a.Fe.O(0)),a.Fe.ka(),a.Fe.ib(g-1),a.Fe.freeze());g=a.$l.count;0<g&&(f=a.$l.O(g-1),a.$l.ib(g-1))}if(d){if(b){a.zs=!1;null===e&&""!==
c&&(e=a.currentTransaction);if(a.isEnabled&&null!==e){e.isComplete||(e.isComplete=!0,e.name=c);b=a.history;b.ka();for(d=b.count-1;d>a.historyIndex;d--)f=b.O(d),null!==f&&f.clear(),b.ib(d),a.zs=!0;d=a.maxHistoryLength;0<=d&&(0===d?b.clear():b.count>=d&&(f=b.O(0),null!==f&&f.clear(),b.ib(0),a.Vd--));0===d||0!==b.count&&b.get(b.count-1)===e||(b.add(e),a.Vd++);b.freeze()}a.isInternalTransaction||a.Gb("CommittedTransaction",c,e)}else{a.ye=!0;try{a.isEnabled&&null!==e&&(e.isComplete=!0,e.undo())}finally{a.isInternalTransaction||
a.Gb("RolledBackTransaction",c,e),a.ye=!1}null!==e&&e.clear()}a.bs=null;a.isPendingClear&&a.clear();a.isPendingClear=!1;a.isPendingUnmodified=!1;return!0}if(a.isEnabled&&!b&&null!==e){a=f;c=e.changes;for(e=c.count-1;e>=a;e--)b=c.O(e),null!==b&&b.undo(),c.ka(),c.ib(e);c.freeze()}return!1}Me.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToUndo;return null!==a&&a.canUndo()?!0:!1};
Me.prototype.undo=function(){if(this.canUndo()){var a=this.transactionToUndo;try{this.ye=!0,this.Gb("StartingUndo","Undo",a),this.Vd--,a.undo()}catch(b){Ca("undo error: "+b.toString())}finally{this.Gb("FinishedUndo","Undo",a),this.ye=!1}}};Me.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToRedo;return null!==a&&a.canRedo()?!0:!1};
Me.prototype.redo=function(){if(this.canRedo()){var a=this.transactionToRedo;try{this.ye=!0,this.Gb("StartingRedo","Redo",a),this.Vd++,a.redo()}catch(b){Ca("redo error: "+b.toString())}finally{this.Gb("FinishedRedo","Redo",a),this.ye=!1}}};Me.prototype.Gb=function(a,b,c){void 0===c&&(c=null);var d=new Ge;d.change=Ie;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.models;a.next();)b=a.value,d.model=b,b.Mt(d)};
Me.prototype.ow=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.bs=b=new Le);var c=a.copy();b=b.changes;b.ka();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.av&&(a=a.diagram,null!==a&&!1===a.Aj||Ca("Change not within a transaction: "+c.toString()))}};
Me.prototype.skipsEvent=function(a){if(null===a||0>a.change.value)return!0;a=a.object;if(null===a)return!1;if(void 0!==a.layer){if(a=a.layer,null!==a&&a.isTemporary)return!0}else if(a.isTemporary)return!0;return!1};
ma.Object.defineProperties(Me.prototype,{models:{configurable:!0,get:function(){return this.sv.iterator}},isEnabled:{configurable:!0,get:function(){return this.nd},set:function(a){this.nd=a}},transactionToUndo:{configurable:!0,get:function(){return 0<=this.historyIndex&&this.historyIndex<=this.history.count-1?this.history.O(this.historyIndex):null}},transactionToRedo:{configurable:!0,get:function(){return this.historyIndex<this.history.count-
1?this.history.O(this.historyIndex+1):null}},isUndoingRedoing:{configurable:!0,get:function(){return this.ye}},history:{configurable:!0,get:function(){return this.L}},maxHistoryLength:{configurable:!0,get:function(){return this.w},set:function(a){this.w=a}},historyIndex:{configurable:!0,get:function(){return this.Vd}},currentTransaction:{configurable:!0,get:function(){return this.bs}},transactionLevel:{configurable:!0,
get:function(){return this.ij}},isInTransaction:{configurable:!0,get:function(){return 0<this.ij}},checksTransactionLevel:{configurable:!0,get:function(){return this.l},set:function(a){this.l=a}},nestedTransactionNames:{configurable:!0,get:function(){return this.Fe}},isPendingClear:{configurable:!0,get:function(){return this.kv},set:function(a){this.kv=a}},isPendingUnmodified:{configurable:!0,get:function(){return this.lv},set:function(a){this.lv=
a}},isInternalTransaction:{configurable:!0,get:function(){return this.hv},set:function(a){this.hv=a}},isJustDiscarded:{configurable:!0,get:function(){return this.zs}}});Me.prototype.handleChanged=Me.prototype.ow;Me.prototype.redo=Me.prototype.redo;Me.prototype.undo=Me.prototype.undo;Me.prototype.canUndo=Me.prototype.canUndo;Me.prototype.rollbackTransaction=Me.prototype.Tf;Me.prototype.commitTransaction=Me.prototype.bb;Me.prototype.startTransaction=Me.prototype.Ca;
Me.prototype.removeModel=Me.prototype.bz;Me.prototype.addModel=Me.prototype.ky;Me.prototype.clear=Me.prototype.clear;Me.className="UndoManager";function Oe(){0<arguments.length&&za(Oe);fb(this);this.B=Pe;this.Wa="";this.nd=!0;this.Vc=!1;this.vx=null;this.yz=new we;this.It=-1}Oe.prototype.toString=function(){return""!==this.name?this.name+" Tool":Pa(this.constructor)};Oe.prototype.updateAdornments=function(){};Oe.prototype.canStart=function(){return this.isEnabled};Oe.prototype.doStart=function(){};
Oe.prototype.doActivate=function(){this.isActive=!0};Oe.prototype.doDeactivate=function(){this.isActive=!1};Oe.prototype.doStop=function(){};Oe.prototype.doCancel=function(){this.transactionResult=null;this.stopTool()};Oe.prototype.stopTool=function(){var a=this.diagram;a.currentTool===this&&(a.currentTool=null,a.currentCursor="")};Oe.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()};Oe.prototype.doMouseMove=function(){};Oe.prototype.doMouseUp=function(){this.stopTool()};
Oe.prototype.doMouseWheel=function(){};Oe.prototype.canStartMultiTouch=function(){return!0};Oe.prototype.standardPinchZoomStart=function(){var a=this.diagram,b=a.lastInput,c=b.Uq(0,J.allocAt(NaN,NaN)),d=b.Uq(1,J.allocAt(NaN,NaN));if(c.o()&&d.o()&&(this.doCancel(),a.Lm("hasGestureZoom"))){a.bm=a.scale;var e=d.x-c.x,f=d.y-c.y;a.Fv=Math.sqrt(e*e+f*f);b.bubbles=!1}J.free(c);J.free(d)};
Oe.prototype.standardPinchZoomMove=function(){var a=this.diagram,b=a.lastInput,c=b.Uq(0,J.allocAt(NaN,NaN)),d=b.Uq(1,J.allocAt(NaN,NaN));if(c.o()&&d.o()&&(this.doCancel(),a.Lm("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.Fv;e=new J((Math.min(d.x,c.x)+Math.max(d.x,c.x))/2,(Math.min(d.y,c.y)+Math.max(d.y,c.y))/2);f*=a.bm;var g=a.commandHandler;if(f!==a.scale&&g.canResetZoom(f)){var h=a.zoomPoint;a.zoomPoint=e;g.resetZoom(f);a.zoomPoint=h}b.bubbles=!1}J.free(c);J.free(d)};
Oe.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()};Oe.prototype.doKeyUp=function(){};Oe.prototype.Ca=function(a){void 0===a&&(a=this.name);this.transactionResult=null;return this.diagram.Ca(a)};Oe.prototype.Vg=function(){var a=this.diagram;return null===this.transactionResult?a.Tf():a.bb(this.transactionResult)};
Oe.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.Im(b.documentPoint,!1);if(null!==c)if(db?b.meta:b.control){a.U("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!b.isSelected);a.U("ChangedSelection",a.selection)}else if(b.shift){if(!c.isSelected){a.U("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!0);a.U("ChangedSelection",
a.selection)}}else{if(!c.isSelected){for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&a.select(b)}}else!b.left||(db?b.meta:b.control)||b.shift||a.clearSelection()}};Oe.prototype.standardMouseClick=function(a,b){void 0===a&&(a=null);void 0===b&&(b=function(a){return!a.layer.isTemporary});var c=this.diagram,d=c.lastInput;a=c.$b(d.documentPoint,a,b);d.targetObject=a;Qe(a,d,c);return d.handled};
function Qe(a,b,c){b.handled=!1;if(null===a||a.Tg()){var d=0;b.left?d=1===b.clickCount?1:2===b.clickCount?2:1:b.right&&1===b.clickCount&&(d=3);var e="ObjectSingleClicked";if(null!==a){switch(d){case 1:e="ObjectSingleClicked";break;case 2:e="ObjectDoubleClicked";break;case 3:e="ObjectContextClicked"}0!==d&&c.U(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.U(e)}if(null!==a)for(;null!==a;){c=null;switch(d){case 1:c=
a.click;break;case 2:c=a.doubleClick?a.doubleClick:a.click;break;case 3:c=a.contextClick}if(null!==c&&(c(b,a),b.handled))break;a=a.panel}else{a=null;switch(d){case 1:a=c.click;break;case 2:a=c.doubleClick?c.doubleClick:c.click;break;case 3:a=c.contextClick}null!==a&&a(b)}}}
Oe.prototype.standardMouseOver=function(){var a=this.diagram,b=a.lastInput;if(!0!==a.animationManager.xc){var c=a.skipsUndoManager;a.skipsUndoManager=!0;var d=a.viewportBounds.fa(b.documentPoint)?a.$b(b.documentPoint,null,null):null;b.targetObject=d;var e=!1;if(d!==a.Nj){var f=a.Nj,g=f;a.Nj=d;this.doCurrentObjectChanged(f,d);for(b.handled=!1;null!==f;){var h=f.mouseLeave;if(null!==h){if(d===f)break;if(null!==d&&d.Sg(f))break;h(b,f,d);e=!0;if(b.handled)break}f=f.panel}f=g;for(b.handled=!1;null!==d;){g=
d.mouseEnter;if(null!==g){if(f===d)break;if(null!==f&&f.Sg(d))break;g(b,d,f);e=!0;if(b.handled)break}d=d.panel}d=a.Nj}if(null!==d){f=d;for(g="";null!==f;){g=f.cursor;if(""!==g)break;f=f.panel}a.currentCursor=g;b.handled=!1;for(f=d;null!==f;){d=f.mouseOver;if(null!==d&&(d(b,f),e=!0,b.handled))break;f=f.panel}}else a.currentCursor="",d=a.mouseOver,null!==d&&(d(b),e=!0);e&&a.Jb();a.skipsUndoManager=c}};Oe.prototype.doCurrentObjectChanged=function(){};
Oe.prototype.standardMouseWheel=function(){var a=this.diagram,b=a.lastInput,c=b.delta;if(0!==c&&a.documentBounds.o()){var d=a.commandHandler,e=a.toolManager.mouseWheelBehavior;if(null!==d&&(e===Re&&!b.shift||e===Se&&b.control)){if(0<c?d.canIncreaseZoom():d.canDecreaseZoom())e=a.zoomPoint,a.zoomPoint=b.viewPoint,0<c?d.increaseZoom():d.decreaseZoom(),a.zoomPoint=e;b.bubbles=!1}else if(e===Re&&b.shift||e===Se&&!b.control){d=a.position.copy();var f=0<c?c:-c,g=b.event,h=g.deltaMode;e=g.deltaX;g=g.deltaY;
if($a||bb||cb)h=1,0<e&&(e=3),0>e&&(e=-3),0<g&&(g=3),0>g&&(g=-3);if(void 0===h||void 0===e||void 0===g||0===e&&0===g||b.shift)!b.shift&&a.allowVerticalScroll?(f=3*f*a.scrollVerticalLineChange,0<c?a.scroll("pixel","up",f):a.scroll("pixel","down",f)):b.shift&&a.allowHorizontalScroll&&(f=3*f*a.scrollHorizontalLineChange,0<c?a.scroll("pixel","left",f):a.scroll("pixel","right",f));else{switch(h){case 0:c="pixel";break;case 1:c="line";break;case 2:c="page";break;default:c="pixel"}0!==e&&a.allowHorizontalScroll&&
(e*=a.scrollHorizontalLineChange/16,0<e?a.scroll(c,"left",-e):a.scroll(c,"right",e));0!==g&&a.allowVerticalScroll&&(g*=a.scrollVerticalLineChange/16,0<g?a.scroll(c,"up",-g):a.scroll(c,"down",g))}a.position.A(d)||(b.bubbles=!1)}}};Oe.prototype.standardWaitAfter=function(a,b){F&&A(a,"number",Oe,"standardWaitAfter:delay");void 0===b&&(b=this.diagram.lastInput);this.cancelWaitAfter();var c=this,d=b.clone(this.yz);this.It=ta(function(){c.doWaitAfter(d)},a)};
Oe.prototype.cancelWaitAfter=function(){-1!==this.It&&qa.clearTimeout(this.It);this.It=-1};Oe.prototype.doWaitAfter=function(){};Oe.prototype.findToolHandleAt=function(a,b){a=this.diagram.$b(a,function(a){for(;null!==a&&!(a.panel instanceof Te);)a=a.panel;return a});return null===a?null:a.part.category===b?a:null};
Oe.prototype.isBeyondDragSize=function(a,b){var c=this.diagram;void 0===a&&(a=c.firstInput.viewPoint);void 0===b&&(b=c.lastInput.viewPoint);var d=c.toolManager.dragSize,e=d.width;d=d.height;c.firstInput.isTouchEvent&&(e+=6,d+=6);return Math.abs(b.x-a.x)>e||Math.abs(b.y-a.y)>d};
ma.Object.defineProperties(Oe.prototype,{diagram:{configurable:!0,get:function(){return this.B},set:function(a){a instanceof Q&&(this.B=a)}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){A(a,"string",Oe,"name");this.Wa=a}},isEnabled:{configurable:!0,get:function(){return this.nd},set:function(a){A(a,"boolean",Oe,"isEnabled");this.nd=a}},isActive:{configurable:!0,get:function(){return this.Vc},set:function(a){A(a,"boolean",
Oe,"isActive");this.Vc=a}},transactionResult:{configurable:!0,get:function(){return this.vx},set:function(a){null!==a&&A(a,"string",Oe,"transactionResult");this.vx=a}}});Oe.prototype.stopTransaction=Oe.prototype.Vg;Oe.prototype.startTransaction=Oe.prototype.Ca;Oe.className="Tool";function Ta(){Oe.call(this);this.name="ToolManager";this.Hc=new H;this.Wc=new H;this.Nd=new H;this.W=this.Oa=850;this.w=(new Hb(2,2)).ia();this.jb=5E3;this.Pa=Se;this.L=Ue;this.$r=this.l=null;this.sk=-1}
la(Ta,Oe);Ta.prototype.initializeStandardTools=function(){};Ta.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof Te&&this.$r===a){var c=b.adornedObject;(null!==a?c.part===a:null===c)?this.showToolTip(b,c):this.hideToolTip()}};
Ta.prototype.doMouseDown=function(){var a=this.diagram,b=a.lastInput;b.isTouchEvent&&this.gestureBehavior===Ve&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===We){b.bubbles=!0;return}if(this.gestureBehavior===Ve)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomStart();return}}var c=a.undoManager;F&&c.checksTransactionLevel&&0!==c.transactionLevel&&Ca("WARNING: In ToolManager.doMouseDown: UndoManager.transactionLevel is not zero");c=this.mouseDownTools.length;
for(var d=0;d<c;d++){var e=this.mouseDownTools.O(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===e&&(e.isActive||e.doActivate(),e.doMouseDown());return}}1===a.lastInput.button&&(this.mouseWheelBehavior===Se?this.mouseWheelBehavior=Re:this.mouseWheelBehavior===Re&&(this.mouseWheelBehavior=Se));this.doActivate();this.standardWaitAfter(this.holdDelay,b)};
Ta.prototype.doMouseMove=function(){var a=this.diagram,b=a.lastInput;if(b.isMultiTouch){if(this.gestureBehavior===We){b.bubbles=!0;return}if(this.gestureBehavior===Ve)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomMove();return}}if(this.isActive)for(var c=this.mouseMoveTools.length,d=0;d<c;d++){var e=this.mouseMoveTools.O(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===e&&(e.isActive||e.doActivate(),e.doMouseMove());return}}af(this,
a);a=b.event;null===a||"mousemove"!==a.type&&"pointermove"!==a.type&&a.cancelable||(b.bubbles=!0)};function af(a,b){a.standardMouseOver();a.isBeyondDragSize()&&a.standardWaitAfter(a.isActive?a.holdDelay:a.hoverDelay,b.lastInput)}Ta.prototype.doCurrentObjectChanged=function(a,b){a=this.currentToolTip;null===a||null!==b&&a instanceof Te&&(b===a||b.Sg(a))||this.hideToolTip()};
Ta.prototype.doWaitAfter=function(a){var b=this.diagram;b.Aa&&(this.doMouseHover(),this.isActive||this.doToolTip(),a.isTouchEvent&&!b.lastInput.handled&&(a=a.copy(),a.button=2,a.buttons=2,b.lastInput=a,b.rk=!0,b.doMouseUp()))};
Ta.prototype.doMouseHover=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.$b(b.documentPoint,null,null));var c=b.targetObject;if(null!==c)for(b.handled=!1;null!==c;){a=this.isActive?c.mouseHold:c.mouseHover;if(null!==a&&(a(b,c),b.handled))break;c=c.panel}else c=this.isActive?a.mouseHold:a.mouseHover,null!==c&&c(b)};
Ta.prototype.doToolTip=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.$b(b.documentPoint,null,null));b=b.targetObject;if(null!==b){if(a=this.currentToolTip,!(a instanceof Te)||b!==a&&!b.Sg(a)){for(;null!==b;){a=b.toolTip;if(null!==a){this.showToolTip(a,b);return}b=b.panel}this.hideToolTip()}}else b=a.toolTip,null!==b?this.showToolTip(b,null):this.hideToolTip()};
Ta.prototype.showToolTip=function(a,b){!F||a instanceof Te||a instanceof bf||v("showToolTip:tooltip must be an Adornment or HTMLInfo.");null!==b&&x(b,N,Ta,"showToolTip:obj");var c=this.diagram;a!==this.currentToolTip&&this.hideToolTip();if(a instanceof Te){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category="ToolTip";null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?a.adornedObject=b:a.data=c.model;a.Ya();this.positionToolTip(a,
b)}else a instanceof bf&&a!==this.currentToolTip&&a.show(b,c,this);this.currentToolTip=a;-1!==this.sk&&(qa.clearTimeout(this.sk),this.sk=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.sk=ta(function(){e.hideToolTip()},a)}};
Ta.prototype.positionToolTip=function(a){if(null===a.placeholder){var b=this.diagram,c=b.lastInput.documentPoint.copy(),d=a.measuredBounds,e=b.viewportBounds;b.lastInput.isTouchEvent&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5/b.scale);c.x<e.x&&(c.x=e.x);c.y=c.y+20/b.scale+d.height>e.bottom?c.y-(d.height+5/b.scale):c.y+20/b.scale;c.y<e.y&&(c.y=e.y);a.position=c}};
Ta.prototype.hideToolTip=function(){-1!==this.sk&&(qa.clearTimeout(this.sk),this.sk=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof Te?(a.remove(b),null!==this.$r&&this.$r.Sf(b.category),b.data=null,b.adornedObject=null):b instanceof bf&&null!==b.hide&&b.hide(a,this),this.currentToolTip=null)};
Ta.prototype.doMouseUp=function(){this.cancelWaitAfter();var a=this.diagram;if(this.isActive)for(var b=this.mouseUpTools.length,c=0;c<b;c++){var d=this.mouseUpTools.O(c);d.diagram=this.diagram;if(d.canStart()){a.doFocus();a.currentTool=d;a.currentTool===d&&(d.isActive||d.doActivate(),d.doMouseUp());return}}a.doFocus();this.doDeactivate()};Ta.prototype.doMouseWheel=function(){this.standardMouseWheel()};Ta.prototype.doKeyDown=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyDown()};
Ta.prototype.doKeyUp=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyUp()};Ta.prototype.findTool=function(a){A(a,"string",Ta,"findTool:name");for(var b=this.mouseDownTools.length,c=0;c<b;c++){var d=this.mouseDownTools.O(c);if(d.name===a)return d}b=this.mouseMoveTools.length;for(c=0;c<b;c++)if(d=this.mouseMoveTools.O(c),d.name===a)return d;b=this.mouseUpTools.length;for(c=0;c<b;c++)if(d=this.mouseUpTools.O(c),d.name===a)return d;return null};
Ta.prototype.replaceTool=function(a,b){A(a,"string",Ta,"replaceTool:name");null!==b&&(x(b,Oe,Ta,"replaceTool:newtool"),b.diagram=this.diagram);for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.O(d);if(e.name===a)return null!==b?this.mouseDownTools.td(d,b):this.mouseDownTools.ib(d),e}c=this.mouseMoveTools.length;for(d=0;d<c;d++)if(e=this.mouseMoveTools.O(d),e.name===a)return null!==b?this.mouseMoveTools.td(d,b):this.mouseMoveTools.ib(d),e;c=this.mouseUpTools.length;for(d=
0;d<c;d++)if(e=this.mouseUpTools.O(d),e.name===a)return null!==b?this.mouseUpTools.td(d,b):this.mouseUpTools.ib(d),e;return null};Ta.prototype.eb=function(a,b,c){A(a,"string",Ta,"replaceStandardTool:name");x(c,H,Ta,"replaceStandardTool:list");null!==b&&(x(b,Oe,Ta,"replaceStandardTool:newtool"),b.name=a,b.diagram=this.diagram);this.findTool(a)?this.replaceTool(a,b):null!==b&&c.add(b)};
ma.Object.defineProperties(Ta.prototype,{mouseWheelBehavior:{configurable:!0,get:function(){return this.Pa},set:function(a){hb(a,Ta,Ta,"mouseWheelBehavior");this.Pa=a}},gestureBehavior:{configurable:!0,get:function(){return this.L},set:function(a){hb(a,Ta,Ta,"gestureBehavior");this.L=a}},currentToolTip:{configurable:!0,get:function(){return this.l},set:function(a){!F||null===a||a instanceof Te||a instanceof bf||v("ToolManager.currentToolTip must be an Adornment or HTMLInfo.");
this.l=a;this.$r=null!==a&&a instanceof Te?a.adornedPart:null}},mouseDownTools:{configurable:!0,get:function(){return this.Hc}},mouseMoveTools:{configurable:!0,get:function(){return this.Wc}},mouseUpTools:{configurable:!0,get:function(){return this.Nd}},hoverDelay:{configurable:!0,get:function(){return this.Oa},set:function(a){A(a,"number",Ta,"hoverDelay");this.Oa=a}},holdDelay:{configurable:!0,get:function(){return this.W},set:function(a){A(a,
"number",Ta,"holdDelay");this.W=a}},dragSize:{configurable:!0,get:function(){return this.w},set:function(a){x(a,Hb,Ta,"dragSize");this.w=a.J()}},toolTipDuration:{configurable:!0,get:function(){return this.jb},set:function(a){A(a,"number",Ta,"toolTipDuration");this.jb=a}}});Ta.prototype.replaceStandardTool=Ta.prototype.eb;
var Se=new E(Ta,"WheelScroll",0),Re=new E(Ta,"WheelZoom",1),cf=new E(Ta,"WheelNone",2),Ue=new E(Ta,"GestureZoom",3),Ve=new E(Ta,"GestureCancel",4),We=new E(Ta,"GestureNone",5);Ta.className="ToolManager";Ta.WheelScroll=Se;Ta.WheelZoom=Re;Ta.WheelNone=cf;Ta.GestureZoom=Ue;Ta.GestureCancel=Ve;Ta.GestureNone=We;
function df(){Oe.call(this);0<arguments.length&&za(df);this.name="Dragging";this.L=this.Wc=!0;this.w=this.jb=this.Oa=this.Bg=null;this.fo=this.Nd=!1;this.qm=new J(NaN,NaN);this.vt=new J;this.Hc=!0;this.ul=100;this.ih=[];this.Cr=(new I).freeze();this.Pa=new ef;this.Oo=null;this.W="copy";this.gi="";this.hi="no-drop"}la(df,Oe);
df.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly&&!a.allowDragOut||!a.allowMove&&!a.allowCopy&&!a.allowDragOut||!a.allowSelect)return!1;var b=a.lastInput;return!b.left||a.currentTool!==this&&(!this.isBeyondDragSize()||b.isTouchEvent&&b.timestamp-a.firstInput.timestamp<this.ul)?!1:null!==this.findDraggablePart()};
df.prototype.findDraggablePart=function(){var a=this.diagram;a=a.Im(a.firstInput.documentPoint,!1);if(null===a)return null;for(;null!==a&&!a.canSelect();)a=a.containingGroup;return null!==a&&(a.canMove()||a.canCopy())?a:null};
df.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.Im(a.firstInput.documentPoint,!1);if(null!==b){for(;null!==b&&!b.canSelect();)b=b.containingGroup;this.currentPart=b;null===this.currentPart||this.currentPart.isSelected||(a.U("ChangingSelection",a.selection),b=a.lastInput,(db?b.meta:b.control)||b.shift||a.clearSelection(!0),this.currentPart.isSelected=!0,a.U("ChangedSelection",a.selection))}}};
df.prototype.doActivate=function(){var a=this.diagram;this.Oo=null;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(ff=null,this.isActive=!0,this.qm.set(a.position),gf(this,a.selection),this.ih.length=0,a.animationManager.Tc(),this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),a.zu=!0,!0===a.Te("temporaryPixelRatio")&&30<a.ny&&hf(a),jf(a,this.draggedParts),this.Ca("Drag"),this.startPoint=a.firstInput.documentPoint,
a.isMouseCaptured=!0,a.allowDragOut&&(this.isDragOutStarted=!0,this.fo=!1,ff=this,kf=this.diagram,this.doSimulatedDragOut()))};function gf(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.Jk()&&1===b.count&&b.first()instanceof R?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.xk(),a.Bg=c.toolManager.findTool("Relinking"),null===a.Bg&&(a.Bg=new lf,a.Bg.diagram=c)):(a.draggedLink=null,a.Bg=null))}}
df.prototype.computeEffectiveCollection=function(a,b){return this.diagram.commandHandler.computeEffectiveCollection(a,b)};df.prototype.Dd=function(a){return void 0===a?new mf(Ob):this.isGridSnapEnabled?new mf(new J(Math.round(1E3*a.x)/1E3,Math.round(1E3*a.y)/1E3)):new mf(a.copy())};
df.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.Uf();nf(this);of(a,this.draggedParts);this.draggedParts=this.currentPart=this.Oo=null;this.fo=this.isDragOutStarted=!1;if(0<pf.count){for(var b=pf,c=b.length,d=0;d<c;d++){var e=b.O(d);qf(e);rf(e);nf(e);e.diagram.Uf()}b.clear()}qf(this);this.qm.h(NaN,NaN);ff=kf=null;rf(this);a.isMouseCaptured=!1;a.currentCursor="";a.zu=!1;this.Vg();wf(a,!0)};
function nf(a){var b=a.diagram,c=b.skipsUndoManager;b.skipsUndoManager=!0;xf(a,b.lastInput,null);b.skipsUndoManager=c;a.ih.length=0}function yf(){var a=ff;rf(a);zf(a);var b=a.diagram;a.qm.o()&&(b.position=a.qm);b.Uf()}df.prototype.doCancel=function(){rf(this);zf(this);var a=this.diagram;this.qm.o()&&(a.position=this.qm);this.stopTool()};df.prototype.doKeyDown=function(){this.isActive&&("Esc"===this.diagram.lastInput.key?this.doCancel():this.doMouseMove())};
df.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()};function Af(a,b){var c=Infinity,d=Infinity,e=-Infinity,f=-Infinity;for(a=a.iterator;a.next();){var g=a.value;if(g.bc()&&g.isVisible()){var h=g.location;g=h.x;h=h.y;isNaN(g)||isNaN(h)||(g<c&&(c=g),h<d&&(d=h),g>e&&(e=g),h>f&&(f=h))}}Infinity===c?b.h(0,0,0,0):b.h(c,d,e-c,f-d)}
function Bf(a,b){if(null===a.copiedParts){var c=a.diagram;if((!b||!c.isReadOnly&&!c.isModelReadOnly)&&null!==a.draggedParts){var d=c.undoManager;d.isEnabled&&d.isInTransaction?null!==d.currentTransaction&&0<d.currentTransaction.changes.count&&(c.undoManager.Tf(),c.Ca("Drag")):zf(a);c.skipsUndoManager=!b;c.partManager.addsToTemporaryLayer=!b;a.startPoint=c.firstInput.documentPoint;b=a.copiesEffectiveCollection?a.draggedParts.Vf():c.selection;c=c.Ck(b,c,!0);for(b=c.iterator;b.next();)b.value.location=
b.key.location;b=L.alloc();Af(c,b);L.free(b);b=new Db;for(d=a.draggedParts.iterator;d.next();){var e=d.key;e.bc()&&e.canCopy()&&(e=c.K(e),null!==e&&(e.Ya(),b.add(e,a.Dd(e.location))))}for(c=c.iterator;c.next();)d=c.value,d instanceof R&&d.canCopy()&&b.add(d,a.Dd());a.copiedParts=b;gf(a,b.Vf());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,Cf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/2)))}}}
function rf(a){var b=a.diagram;if(null!==a.copiedParts&&(b.tu(a.copiedParts.Vf(),!1),a.copiedParts=null,null!==a.draggedParts))for(var c=a.draggedParts.iterator;c.next();)c.key instanceof R&&(c.value.point=new J(0,0));b.skipsUndoManager=!1;b.partManager.addsToTemporaryLayer=!1;a.startPoint=b.firstInput.documentPoint}
function qf(a){if(null!==a.draggedLink){if(a.dragsLink&&null!==a.Bg){var b=a.Bg;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode)}a.draggedLink=null;a.Bg=null}}function Df(a,b,c){var d=a.diagram,e=a.startPoint,f=J.alloc();f.assign(d.lastInput.documentPoint);a.moveParts(b,f.ke(e),c);J.free(f);!0===d.Te("temporaryPixelRatio")&&null===d.Jh&&30<d.ny&&(hf(d),d.mr())}df.prototype.moveParts=function(a,b,c){var d=this.diagram;null!==d&&Ef(d,a,b,this.dragOptions,c)};
function zf(a){if(null!==a.draggedParts){for(var b=a.diagram,c=a.draggedParts.iterator;c.next();){var d=c.key;d.bc()&&(d.location=c.value.point)}for(c=a.draggedParts.iterator;c.next();)if(d=c.key,d instanceof R&&d.suspendsRouting){var e=c.value.point;a.draggedParts.add(d,a.Dd());Cf(d,-e.x,-e.y)}b.jd()}}
function Ff(a,b){var c=a.diagram;a.dragsLink&&(null!==a.draggedLink&&(a.draggedLink.fromNode=null,a.draggedLink.toNode=null),Gf(a,!1));var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;a.doUpdateCursor(d);var f=c.skipsUndoManager,g=!1;try{c.skipsUndoManager=!0;g=xf(a,e,d);if(!a.isActive&&null===ff)return;var h=null!==d?d.part:null;if(null===h||c.handlesDragDropForTopLevelParts&&h.isTopLevel&&!(h instanceof Hf)){var k=c.mouseDragOver;null!==k&&(k(e),g=!0)}if(!a.isActive&&null===ff)return;
a.doDragOver(b,d);if(!a.isActive&&null===ff)return}finally{c.skipsUndoManager=f,g&&c.jd()}a.Oo=d;c.isReadOnly||!c.allowMove&&!c.allowCopy||!c.allowHorizontalScroll&&!c.allowVerticalScroll||c.St(e.viewPoint)}df.prototype.findDragOverObject=function(a){var b=this;return If(this.diagram,a,null,function(a){null===a?a=!0:(a=a.part,a=null===a||a instanceof Te||a.layer.isTemporary||b.draggedParts&&b.draggedParts.contains(a)||b.copiedParts&&b.copiedParts.contains(a)?!0:!1);return!a})};
df.prototype.doUpdateCursor=function(a){var b=this.diagram;this.Oo!==a&&(!this.diagram.currentTool.isActive||this.mayCopy()?b.currentCursor=this.copyCursor:this.mayMove()?b.currentCursor=this.moveCursor:this.mayDragOut()&&(b.currentCursor=this.nodropCursor))};
function xf(a,b,c){var d=!1,e=a.ih.length,f=0<e?a.ih[0]:null;if(c===f)return!1;b.handled=!1;for(var g=0;g<e;g++){var h=a.ih[g],k=h.mouseDragLeave;if(null!==k&&(k(b,h,c),d=!0,b.handled))break}a.ih.length=0;if(!a.isActive&&null===ff||null===c)return d;b.handled=!1;for(e=c;null!==e;)a.ih.push(e),e=Jf(e);e=a.ih.length;for(c=0;c<e&&(g=a.ih[c],h=g.mouseDragEnter,null===h||(h(b,g,f),d=!0,!b.handled));c++);return d}
function Jf(a){var b=a.panel;return null!==b?b:a instanceof S&&!(a instanceof Hf)&&(a=a.containingGroup,null!==a&&a.handlesDragDropForMembers)?a:null}function Kf(a,b,c){var d=a.Bg;if(null===d)return null;var e=a.diagram.Qg(b,d.portGravity,function(a){return d.findValidLinkablePort(a,c)});a=J.alloc();var f=Infinity,g=null;for(e=e.iterator;e.next();){var h=e.value;if(null!==h.part){var k=h.ma(Mc,a);k=b.Se(k);k<f&&(g=h,f=k)}}J.free(a);return g}
function Gf(a,b){var c=a.draggedLink;if(null!==c&&!(2>c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.Bg;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=Kf(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=Kf(a,c.i(c.pointsCount-1),!0),null!==h&&(k=h.part));e.isValidLink(g,f,k,h)?b?(c.defaultFromPoint=c.i(0),c.defaultToPoint=c.i(c.pointsCount-1),c.suspendsRouting=!1,c.fromNode=g,null!==f&&(c.fromPortId=f.portId),c.toNode=k,null!==h&&(c.toPortId=h.portId),c.fromPort!==
d.Xy&&d.U("LinkRelinked",c,d.Xy),c.toPort!==d.Yy&&d.U("LinkRelinked",c,d.Yy)):Lf(e,g,f,k,h):Lf(e,null,null,null,null)}}}}df.prototype.doDragOver=function(){};
function Mf(a,b){var c=a.diagram;a.dragsLink&&Gf(a,!0);nf(a);var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;if(null!==d){e.handled=!1;for(var f=d;null!==f;){var g=f.mouseDrop;if(null!==g&&(g(e,f),e.handled))break;Nf(a,e,f);f=Jf(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==ff){for(e=(a.copiedParts||a.draggedParts).iterator;e.next();)f=e.key,f instanceof U&&f.linksConnected.each(function(a){a.suspendsRouting=!1});a.doDropOnto(b,d);if(a.isActive||null!==ff){a=L.alloc();for(b=
c.selection.iterator;b.next();)d=b.value,d instanceof U&&Of(c,d,a);L.free(a)}}}function Nf(a,b,c){a=a.diagram;c=c.part;!a.handlesDragDropForTopLevelParts||!c.isTopLevel||c instanceof Hf||(c=a.mouseDrop,null!==c&&c(b))}function Of(a,b,c){var d=!1;b.getAvoidableRect(c);a.viewportBounds.Qe(c)&&(d=!0);a=a.iw(c,function(a){return a.part},function(a){return a instanceof R},!0,function(a){return a instanceof R},d);if(0!==a.count)for(a=a.iterator;a.next();)c=a.value,!c.Jd(b)&&c.isAvoiding&&c.Za()}
df.prototype.doDropOnto=function(){};df.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;this.simulatedMouseMove(b.event,b.documentPoint,b.targetDiagram)||null===this.currentPart||null===this.draggedParts||(this.mayCopy()?(Bf(this,!1),jf(a,this.copiedParts),Df(this,this.copiedParts,!1),of(a,this.copiedParts)):this.mayMove()?(rf(this),Df(this,this.draggedParts,!0)):this.mayDragOut()?(Bf(this,!1),Df(this,this.copiedParts,!1)):rf(this),Ff(this,a.lastInput.documentPoint))}};
df.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;if(!this.simulatedMouseUp(b.event,b.documentPoint,b.targetDiagram)){b=!1;var c=this.mayCopy();c&&null!==this.copiedParts?(rf(this),Bf(this,!0),jf(a,this.copiedParts),Df(this,this.copiedParts,!1),of(a,this.copiedParts),null!==this.copiedParts&&(a.U("ChangingSelection",a.selection),a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}))):(b=!0,rf(this),this.mayMove()&&(Df(this,this.draggedParts,
!0),Ff(this,a.lastInput.documentPoint)));this.fo=!0;Mf(this,a.lastInput.documentPoint);if(this.isActive){var d=c?this.copiedParts.Vf():this.draggedParts.Vf();this.copiedParts=null;b&&Pf(this);a.Ua();of(a,this.draggedParts);this.transactionResult=c?"Copy":"Move";a.U(c?"SelectionCopied":"SelectionMoved",d)}this.stopTool();c&&a.U("ChangedSelection",a.selection)}}};
df.prototype.simulatedMouseMove=function(a,b,c){if(null===ff)return!1;var d=ff.diagram;c instanceof Q||(c=null);var e=kf;c!==e&&(null!==e&&e!==d&&(e.Uf(),ff.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),kf=c,null!==c&&c!==d&&(yf(),e=c.toolManager.findTool("Dragging"),null!==e&&(pf.contains(e)||pf.add(e),e.doSimulatedDragEnter())));if(null===c||c===d||!c.allowDrop||c.isReadOnly||!c.allowInsert)return!1;d=c.toolManager.findTool("Dragging");null!==d&&(null!==
a&&(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&(a=a.changedTouches[0])),b=c.getMouse(a)),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.xr(b),c.lastInput.down=!1,c.lastInput.up=!1,d.doSimulatedDragOver());return!0};
df.prototype.simulatedMouseUp=function(a,b,c){if(null===ff)return!1;var d=kf,e=ff.diagram;if(null===c)return ff.doCancel(),!0;if(c!==d){var f=d.toolManager.findTool("Dragging");if(null!==d&&d!==e&&null!==f)return d.Uf(),ff.isDragOutStarted=!1,f.doSimulatedDragLeave(),!1;kf=c;d=c.toolManager.findTool("Dragging");null!==d&&(yf(),pf.contains(d)||pf.add(d),d.doSimulatedDragEnter())}return c!==this.diagram?(null!==a?(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&
(a=a.changedTouches[0])),b=c.getMouse(a)):null===b&&(b=new J),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.xr(b),c.lastInput.down=!1,c.lastInput.up=!0,a=c.toolManager.findTool("Dragging"),null!==a&&a.doSimulatedDrop(),a=ff,null!==a&&(c=a.mayCopy(),a.transactionResult=c?"Copy":"Move",a.stopTool()),!0):!1};
function Pf(a){if(null!==a.draggedParts)for(var b=a.draggedParts.iterator;b.next();){var c=b.key;c instanceof U&&(c=c.containingGroup,null===c||null===c.placeholder||a.draggedParts.contains(c)||c.placeholder.v())}}
df.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowCopy||(db?!a.lastInput.alt:!a.lastInput.control))return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.bc()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
df.prototype.mayDragOut=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(!a.allowDragOut||!a.allowCopy||a.allowMove)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.bc()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
df.prototype.mayMove=function(){var a=this.diagram;if(a.isReadOnly||!a.allowMove)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.bc()&&b.canMove())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canMove()?!0:!1};df.prototype.computeBorder=function(a,b,c){return this.fo||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};df.prototype.AA=function(){return ff};
df.prototype.mayDragIn=function(){var a=this.diagram;if(!a.allowDrop||a.isReadOnly||a.isModelReadOnly||!a.allowInsert)return!1;var b=ff;return null===b||b.diagram.model.dataFormat!==a.model.dataFormat?!1:!0};df.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.diagram;a.animationManager.Tc();Qf(a);a.animationManager.Tc();var b=ff;null!==b&&(b.diagram.zu=!1);this.doUpdateCursor(a.grid)}};
df.prototype.doSimulatedDragLeave=function(){var a=ff;null!==a&&a.doSimulatedDragOut();this.doCancel()};df.prototype.doSimulatedDragOver=function(){var a=this.diagram;a.animationManager.Fn=!0;var b=ff;if(null!==b&&null!==b.draggedParts){if(!this.mayDragIn())return;Wf(this,b.draggedParts.Vf(),!1,a.firstInput);Df(this,this.copiedParts,!1);Ff(this,a.lastInput.documentPoint)}a.animationManager.Fn=!1};
df.prototype.doSimulatedDrop=function(){var a=this.diagram,b=ff;if(null!==b){var c=b.diagram;b.fo=!0;rf(this);if(!this.mayDragIn())return;a.animationManager.Fn=!0;a.U("ChangingSelection",a.selection);this.Ca("Drop");Wf(this,b.draggedParts.Vf(),!0,a.lastInput);Df(this,this.copiedParts,!1);null!==this.copiedParts&&(a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}));Mf(this,a.lastInput.documentPoint);a.Ua();b=a.selection;null!==this.copiedParts?this.transactionResult=
"ExternalCopy":b=new I;this.copiedParts=null;a.doFocus();a.U("ExternalObjectsDropped",b,c);this.Vg();a.U("ChangedSelection",a.selection)}a.animationManager.Fn=!1};
function Wf(a,b,c,d){if(null===a.copiedParts){var e=a.diagram;if(!e.isReadOnly&&!e.isModelReadOnly){e.skipsUndoManager=!c;e.partManager.addsToTemporaryLayer=!c;a.startPoint=d.documentPoint;c=e.Ck(b,e,!0);var f=L.alloc();Af(b,f);d=f.x+f.width/2;e=f.y+f.height/2;L.free(f);f=a.vt;var g=new Db,h=J.alloc();for(b=b.iterator;b.next();){var k=b.value,l=c.K(k);k.bc()&&k.canCopy()?(k=k.location,h.h(f.x-(d-k.x),f.y-(e-k.y)),l.location=h,l.Ya(),g.add(l,a.Dd(h))):l instanceof R&&k.canCopy()&&(Cf(l,f.x-d,f.y-e),
g.add(l,a.Dd()))}J.free(h);a.copiedParts=g;gf(a,g.Vf());null!==a.draggedLink&&(c=a.draggedLink,d=c.routeBounds,Cf(c,a.startPoint.x-(d.x+d.width/2),a.startPoint.y-(d.y+d.height/2)))}}}df.prototype.doSimulatedDragOut=function(){var a=this.diagram;a.zu=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor=this.nodropCursor;this.Oo=null};df.prototype.computeMove=function(a,b,c,d){c=this.diagram;return null!==c?c.computeMove(a,b,this.dragOptions,d):new J};
ma.Object.defineProperties(df.prototype,{isCopyEnabled:{configurable:!0,get:function(){return this.Wc},set:function(a){A(a,"boolean",df,"isCopyEnabled");this.Wc=a}},copiesEffectiveCollection:{configurable:!0,get:function(){return this.L},set:function(a){A(a,"boolean",df,"copiesEffectiveCollection");this.L=a}},dragOptions:{configurable:!0,get:function(){return this.Pa},set:function(a){x(a,ef,df,"dragOptions");this.Pa=a}},isGridSnapEnabled:{configurable:!0,
enumerable:!0,get:function(){return this.dragOptions.isGridSnapEnabled},set:function(a){A(a,"boolean",df,"isGridSnapEnabled");this.dragOptions.isGridSnapEnabled=a}},isComplexRoutingRealtime:{configurable:!0,get:function(){return this.Hc},set:function(a){A(a,"boolean",df,"isComplexRoutingRealtime");this.Hc=a}},isGridSnapRealtime:{configurable:!0,get:function(){return this.dragOptions.isGridSnapRealtime},set:function(a){A(a,"boolean",df,"isGridSnapRealtime");this.dragOptions.isGridSnapRealtime=
a}},gridSnapCellSize:{configurable:!0,get:function(){return this.dragOptions.gridSnapCellSize},set:function(a){x(a,Hb,df,"gridSnapCellSize");this.dragOptions.gridSnapCellSize.A(a)||(a=a.J(),this.dragOptions.gridSnapCellSize=a)}},gridSnapCellSpot:{configurable:!0,get:function(){return this.dragOptions.gridSnapCellSpot},set:function(a){x(a,M,df,"gridSnapCellSpot");this.dragOptions.gridSnapCellSpot.A(a)||(a=a.J(),this.dragOptions.gridSnapCellSpot=a)}},gridSnapOrigin:{configurable:!0,
enumerable:!0,get:function(){return this.dragOptions.gridSnapOrigin},set:function(a){x(a,J,df,"gridSnapOrigin");this.dragOptions.gridSnapOrigin.A(a)||(a=a.J(),this.dragOptions.gridSnapOrigin=a)}},dragsLink:{configurable:!0,get:function(){return this.dragOptions.dragsLink},set:function(a){A(a,"boolean",df,"dragsLink");this.dragOptions.dragsLink=a}},dragsTree:{configurable:!0,get:function(){return this.dragOptions.dragsTree},set:function(a){A(a,"boolean",df,"dragsTree");
this.dragOptions.dragsTree=a}},copyCursor:{configurable:!0,get:function(){return this.W},set:function(a){this.W=a}},moveCursor:{configurable:!0,get:function(){return this.gi},set:function(a){this.gi=a}},nodropCursor:{configurable:!0,get:function(){return this.hi},set:function(a){this.hi=a}},currentPart:{configurable:!0,get:function(){return this.Oa},set:function(a){null!==a&&x(a,S,df,"currentPart");this.Oa=a}},copiedParts:{configurable:!0,
get:function(){return this.w},set:function(a){this.w=a}},draggedParts:{configurable:!0,get:function(){return this.jb},set:function(a){this.jb=a}},draggingParts:{configurable:!0,get:function(){return null!==this.copiedParts?this.copiedParts.Vf():null!==this.draggedParts?this.draggedParts.Vf():this.Cr}},draggedLink:{configurable:!0,get:function(){return this.diagram.draggedLink},set:function(a){null!==a&&x(a,R,df,"draggedLink");this.diagram.draggedLink=a}},
isDragOutStarted:{configurable:!0,get:function(){return this.Nd},set:function(a){this.Nd=a}},startPoint:{configurable:!0,get:function(){return this.vt},set:function(a){x(a,J,df,"startPoint");this.vt.A(a)||this.vt.assign(a)}},delay:{configurable:!0,get:function(){return this.ul},set:function(a){A(a,"number",df,"delay");this.ul=a}}});df.prototype.getDraggingSource=df.prototype.AA;var pf=null,ff=null,kf=null;df.className="DraggingTool";pf=new H;
Sa("draggingTool",function(){return this.findTool("Dragging")},function(a){this.eb("Dragging",a,this.mouseMoveTools)});Ta.prototype.doCancel=function(){null!==ff&&ff.doCancel();Oe.prototype.doCancel.call(this)};
function Xf(){0<arguments.length&&za(Xf);Oe.call(this);this.hi=100;this.Pa=!1;this.Ai="pointer";var a=new R,b=new Yf;b.isPanelMain=!0;b.stroke="blue";a.add(b);b=new Yf;b.toArrow="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.layerName="Tool";this.tx=a;a=new U;b=new Yf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=Xb;a.add(b);a.selectable=!1;a.layerName="Tool";this.sx=a;this.l=b;a=new U;b=new Yf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke=
"magenta";b.strokeWidth=2;b.desiredSize=Xb;a.add(b);a.selectable=!1;a.layerName="Tool";this.ux=a;this.w=b;this.gi=this.Nd=this.Hc=this.jb=this.Wc=null;this.Oa=!0;this.pz=new Db;this.Cr=this.Si=this.qx=null}la(Xf,Oe);Xf.prototype.doStop=function(){this.diagram.Uf();this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null;this.validPortsCache.clear();this.targetPort=null};
Xf.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){var f=b.Mf(),g=Hb.alloc();g.width=b.naturalBounds.width*f;g.height=b.naturalBounds.height*f;d.desiredSize=g;Hb.free(g);e?(d.toSpot=b.toSpot,d.toEndSegmentLength=b.toEndSegmentLength):(d.fromSpot=b.fromSpot,d.fromEndSegmentLength=b.fromEndSegmentLength);c.locationSpot=Mc;f=J.alloc();c.location=b.ma(Mc,f);J.free(f);d.angle=b.wj();null!==this.portTargeted&&this.portTargeted(a,b,c,d,e)}};
Xf.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.desiredSize=Xb,b.fromSpot=Gc,b.toSpot=Gc);null!==a&&(a.location=this.diagram.lastInput.documentPoint);null!==this.portTargeted&&this.portTargeted(null,null,a,b,c)};Xf.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()};
Xf.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort&&this.targetPort.part instanceof U){var b=this.targetPort.part;this.isForwards?this.copyPortProperties(b,this.targetPort,this.temporaryToNode,this.temporaryToPort,!0):this.copyPortProperties(b,this.targetPort,this.temporaryFromNode,this.temporaryFromPort,!1)}else this.isForwards?this.setNoTargetPortProperties(this.temporaryToNode,this.temporaryToPort,
!0):this.setNoTargetPortProperties(this.temporaryFromNode,this.temporaryFromPort,!1);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.St(a.lastInput.viewPoint)}};Xf.prototype.findValidLinkablePort=function(a,b){if(null===a)return null;var c=a.part;if(!(c instanceof U))return null;for(;null!==a;){var d=b?a.toLinkable:a.fromLinkable;if(!0===d&&(null!==a.portId||a instanceof U)&&(b?this.isValidTo(c,a):this.isValidFrom(c,a)))return a;if(!1===d)break;a=a.panel}return null};
Xf.prototype.findTargetPort=function(a){var b=this.diagram,c=b.lastInput.documentPoint,d=this.portGravity;0>=d&&(d=.1);var e=this,f=b.Qg(c,d,function(b){return e.findValidLinkablePort(b,a)},null,!0);d=Infinity;b=null;for(f=f.iterator;f.next();){var g=f.value,h=g.part;if(h instanceof U){var k=g.ma(Mc,J.alloc()),l=c.x-k.x,m=c.y-k.y;J.free(k);k=l*l+m*m;k<d&&(l=this.validPortsCache.K(g),null!==l?l&&(b=g,d=k):a&&this.isValidLink(this.originalFromNode,this.originalFromPort,h,g)||!a&&this.isValidLink(h,
g,this.originalToNode,this.originalToPort)?(this.validPortsCache.add(g,!0),b=g,d=k):this.validPortsCache.add(g,!1))}}return null!==b&&(c=b.part,c instanceof U&&(null===c.layer||c.layer.allowLink))?b:null};
Xf.prototype.isValidFrom=function(a,b){if(null===a||null===b)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(null!==a.layer&&!a.layer.allowLink||!0!==b.fromLinkable))return!1;var c=b.fromMaxLinks;if(Infinity>c){if(null!==this.originalLink&&a===this.originalFromNode&&b===this.originalFromPort)return!0;b=b.portId;null===b&&(b="");if(a.Qq(b).count>=c)return!1}return!0};
Xf.prototype.isValidTo=function(a,b){if(null===a||null===b)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(null!==a.layer&&!a.layer.allowLink||!0!==b.toLinkable))return!1;var c=b.toMaxLinks;if(Infinity>c){if(null!==this.originalLink&&a===this.originalToNode&&b===this.originalToPort)return!0;b=b.portId;null===b&&(b="");if(a.Hd(b).count>=c)return!1}return!0};
Xf.prototype.isInSameNode=function(a,b){if(null===a||null===b)return!1;if(a===b)return!0;a=a.part;b=b.part;return null!==a&&a===b};Xf.prototype.isLinked=function(a,b){if(null===a||null===b)return!1;var c=a.part;if(!(c instanceof U))return!1;a=a.portId;null===a&&(a="");var d=b.part;if(!(d instanceof U))return!1;b=b.portId;null===b&&(b="");for(b=d.Hd(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1};
Xf.prototype.isValidLink=function(a,b,c,d){if(!this.isValidFrom(a,b)||!this.isValidTo(c,d)||!(null===b||null===d||(b.fromLinkableSelfNode&&d.toLinkableSelfNode||!this.isInSameNode(b,d))&&(b.fromLinkableDuplicates&&d.toLinkableDuplicates||!this.isLinked(b,d)))||null!==this.originalLink&&(null!==a&&this.isLabelDependentOnLink(a,this.originalLink)||null!==c&&this.isLabelDependentOnLink(c,this.originalLink))||null!==a&&null!==c&&(null===a.data&&null!==c.data||null!==a.data&&null===c.data)||!this.isValidCycle(a,
c,this.originalLink))return!1;if(null!==a){var e=a.linkValidation;if(null!==e&&!e(a,b,c,d,this.originalLink))return!1}if(null!==c&&(e=c.linkValidation,null!==e&&!e(a,b,c,d,this.originalLink)))return!1;e=this.linkValidation;return null!==e?e(a,b,c,d,this.originalLink):!0};Xf.prototype.isLabelDependentOnLink=function(a,b){if(null===a)return!1;var c=a.labeledLink;if(null===c)return!1;if(c===b)return!0;var d=new I;d.add(a);return Zf(this,c,b,d)};
function Zf(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),Zf(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),Zf(a,b.labeledLink,c,d))?!0:!1}
Xf.prototype.isValidCycle=function(a,b,c){void 0===c&&(c=null);if(null===a||null===b)return this.isUnconnectedLinkValid;var d=this.diagram.validCycle;if(d!==$f){if(d===ag){d=c||this.temporaryLink;if(null!==d&&!d.isTreeLink)return!0;for(d=b.linksConnected;d.next();){var e=d.value;if(e!==c&&e.isTreeLink&&e.toNode===b)return!1}return!bg(this,a,b,c,!0)}if(d===cg){d=c||this.temporaryLink;if(null!==d&&!d.isTreeLink)return!0;for(d=a.linksConnected;d.next();)if(e=d.value,e!==c&&e.isTreeLink&&e.fromNode===
a)return!1;return!bg(this,a,b,c,!0)}if(d===dg)return a===b?a=!0:(d=new I,d.add(b),a=eg(this,d,a,b,c)),!a;if(d===fg)return!bg(this,a,b,c,!1);if(d===gg)return a===b?a=!0:(d=new I,d.add(b),a=hg(this,d,a,b,c)),!a}return!0};function bg(a,b,c,d,e){if(b===c)return!0;if(null===b||null===c)return!1;for(var f=b.linksConnected;f.next();){var g=f.value;if(g!==d&&(!e||g.isTreeLink)&&g.toNode===b&&(g=g.fromNode,g!==b&&bg(a,g,c,d,e)))return!0}return!1}
function eg(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var f=c.linksConnected;f.next();){var g=f.value;if(g!==e&&g.toNode===c&&(g=g.fromNode,g!==c&&eg(a,b,g,d,e)))return!0}return!1}function hg(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var f=c.linksConnected;f.next();){var g=f.value;if(g!==e){var h=g.fromNode;g=g.toNode;h=h===c?g:h;if(h!==c&&hg(a,b,h,d,e))return!0}}return!1}
ma.Object.defineProperties(Xf.prototype,{portGravity:{configurable:!0,get:function(){return this.hi},set:function(a){A(a,"number",Xf,"portGravity");0<=a&&(this.hi=a)}},isUnconnectedLinkValid:{configurable:!0,get:function(){return this.Pa},set:function(a){A(a,"boolean",Xf,"isUnconnectedLinkValid");this.Pa=a}},linkingCursor:{configurable:!0,get:function(){return this.Ai},set:function(a){this.Ai=a}},temporaryLink:{configurable:!0,get:function(){return this.tx},
set:function(a){x(a,R,Xf,"temporaryLink");this.tx=a}},temporaryFromNode:{configurable:!0,get:function(){return this.sx},set:function(a){x(a,U,Xf,"temporaryFromNode");if(this.sx=a)this.l=a.port}},temporaryFromPort:{configurable:!0,get:function(){return this.l},set:function(a){x(a,N,Xf,"temporaryFromPort");if(null!==this.l){var b=this.l.panel;if(null!==b){var c=b.$.indexOf(this.l);b.ib(c);b.Ab(c,a)}}this.l=a}},temporaryToNode:{configurable:!0,get:function(){return this.ux},
set:function(a){x(a,U,Xf,"temporaryToNode");if(this.ux=a)this.w=a.port}},temporaryToPort:{configurable:!0,get:function(){return this.w},set:function(a){x(a,N,Xf,"temporaryToPort");if(null!==this.w){var b=this.w.panel;if(null!==b){var c=b.$.indexOf(this.w);b.ib(c);b.Ab(c,a)}}this.w=a}},originalLink:{configurable:!0,get:function(){return this.Wc},set:function(a){null!==a&&x(a,R,Xf,"originalLink");this.Wc=a}},originalFromNode:{configurable:!0,get:function(){return this.jb},
set:function(a){null!==a&&x(a,U,Xf,"originalFromNode");this.jb=a}},originalFromPort:{configurable:!0,get:function(){return this.Hc},set:function(a){null!==a&&x(a,N,Xf,"originalFromPort");this.Hc=a}},originalToNode:{configurable:!0,get:function(){return this.Nd},set:function(a){null!==a&&x(a,U,Xf,"originalToNode");this.Nd=a}},originalToPort:{configurable:!0,get:function(){return this.gi},set:function(a){null!==a&&x(a,N,Xf,"originalToPort");this.gi=a}},isForwards:{configurable:!0,
enumerable:!0,get:function(){return this.Oa},set:function(a){A(a,"boolean",Xf,"isForwards");this.Oa=a}},validPortsCache:{configurable:!0,get:function(){return this.pz}},targetPort:{configurable:!0,get:function(){return this.qx},set:function(a){null!==a&&x(a,N,Xf,"targetPort");this.qx=a}},linkValidation:{configurable:!0,get:function(){return this.Si},set:function(a){null!==a&&A(a,"function",Xf,"linkValidation");this.Si=a}},portTargeted:{configurable:!0,
get:function(){return this.Cr},set:function(a){null!==a&&A(a,"function",Xf,"portTargeted");this.Cr=a}}});Xf.className="LinkingBaseTool";function ig(){0<arguments.length&&za(ig);Xf.call(this);this.name="Linking";this.W={};this.L=null;this.M=jg;this.qn=null}la(ig,Xf);ig.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.hu()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()};
ig.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.$b(a.firstInput.documentPoint,null,null));if(null===b||!(b.part instanceof U))return null;a=this.direction;if(a===jg||a===kg){var c=this.findValidLinkablePort(b,!1);if(null!==c)return this.isForwards=!0,c}if(a===jg||a===lg)if(b=this.findValidLinkablePort(b,!0),null!==b)return this.isForwards=!1,b;return null};
ig.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null!==b&&(this.Ca(this.name),a.isMouseCaptured=!0,a.currentCursor=this.linkingCursor,this.isForwards?(null===this.temporaryToNode||this.temporaryToNode.location.o()||(this.temporaryToNode.location=a.lastInput.documentPoint),this.originalFromPort=b,b=this.originalFromPort.part,b instanceof U&&(this.originalFromNode=b),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,
!1)):(null===this.temporaryFromNode||this.temporaryFromNode.location.o()||(this.temporaryFromNode.location=a.lastInput.documentPoint),this.originalToPort=b,b=this.originalToPort.part,b instanceof U&&(this.originalToNode=b),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0)),a.add(this.temporaryFromNode),a.add(this.temporaryToNode),null!==this.temporaryLink&&(null!==this.temporaryFromNode&&(this.temporaryLink.fromNode=this.temporaryFromNode),
null!==this.temporaryToNode&&(this.temporaryLink.toNode=this.temporaryToNode),this.temporaryLink.isTreeLink=this.isNewTreeLink(),this.temporaryLink.Za(),a.add(this.temporaryLink)),this.isActive=!0)};ig.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.remove(this.temporaryLink);a.remove(this.temporaryFromNode);a.remove(this.temporaryToNode);a.isMouseCaptured=!1;a.currentCursor="";this.Vg()};ig.prototype.doStop=function(){Xf.prototype.doStop.call(this);this.startObject=null};
ig.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.transactionResult=null,c=null,d=null,e=null,f=null;try{var g=this.targetPort=this.findTargetPort(this.isForwards);if(null!==g){var h=g.part;h instanceof U&&(this.isForwards?(null!==this.originalFromNode&&(b=this.originalFromNode,c=this.originalFromPort),d=h,e=g):(b=h,c=g,null!==this.originalToNode&&(d=this.originalToNode,e=this.originalToPort)))}else this.isForwards?null!==this.originalFromNode&&this.isUnconnectedLinkValid&&
(b=this.originalFromNode,c=this.originalFromPort):null!==this.originalToNode&&this.isUnconnectedLinkValid&&(d=this.originalToNode,e=this.originalToPort);null!==b||null!==d?(f=this.insertLink(b,c,d,e),null!==f?(null===g&&(this.isForwards?f.defaultToPoint=a.lastInput.documentPoint:f.defaultFromPoint=a.lastInput.documentPoint),a.allowSelect&&(a.U("ChangingSelection",a.selection),a.clearSelection(!0),f.isSelected=!0),this.transactionResult=this.name,a.U("LinkDrawn",f)):this.doNoLink(b,c,d,e)):this.isForwards?
this.doNoLink(this.originalFromNode,this.originalFromPort,null,null):this.doNoLink(null,null,this.originalToNode,this.originalToPort)}finally{this.stopTool(),f&&a.allowSelect&&a.U("ChangedSelection",a.selection)}}};ig.prototype.isNewTreeLink=function(){var a=this.archetypeLinkData;if(null===a)return!0;if(a instanceof R)return a.isTreeLink;var b=this.diagram;if(null===b)return!0;a=b.partManager.getLinkCategoryForData(a);b=b.partManager.findLinkTemplateForCategory(a);return null!==b?b.isTreeLink:!0};
ig.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};ig.prototype.doNoLink=function(){};
ma.Object.defineProperties(ig.prototype,{archetypeLinkData:{configurable:!0,get:function(){return this.W},set:function(a){null!==a&&A(a,"object",ig,"archetypeLinkData");a instanceof N&&x(a,R,ig,"archetypeLinkData");this.W=a}},archetypeLabelNodeData:{configurable:!0,get:function(){return this.L},set:function(a){null!==a&&A(a,"object",ig,"archetypeLabelNodeData");a instanceof N&&x(a,U,ig,"archetypeLabelNodeData");this.L=a}},direction:{configurable:!0,get:function(){return this.M},
set:function(a){hb(a,ig,ig,"direction");this.M=a}},startObject:{configurable:!0,get:function(){return this.qn},set:function(a){null!==a&&x(a,N,ig,"startObject");this.qn=a}}});var jg=new E(ig,"Either",0),kg=new E(ig,"ForwardsOnly",0),lg=new E(ig,"BackwardsOnly",0);ig.className="LinkingTool";ig.Either=jg;ig.ForwardsOnly=kg;ig.BackwardsOnly=lg;
function lf(){0<arguments.length&&za(lf);Xf.call(this);this.name="Relinking";var a=new Yf;a.figure="Diamond";a.desiredSize=$b;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=0;this.W=a;a=new Yf;a.figure="Diamond";a.desiredSize=$b;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=-1;this.qn=a;this.L=null;this.Tx=new L}la(lf,Xf);
lf.prototype.updateAdornments=function(a){if(null!==a&&a instanceof R){var b="RelinkFrom",c=null;if(a.isSelected&&!this.diagram.isReadOnly){var d=a.selectionObject;null!==d&&a.canRelinkFrom()&&a.actualBounds.o()&&a.isVisible()&&d.actualBounds.o()&&d.Rf()&&(c=a.Fk(b),null===c&&(c=this.makeAdornment(d,!1),a.Rh(b,c)))}null===c&&a.Sf(b);b="RelinkTo";c=null;a.isSelected&&!this.diagram.isReadOnly&&(d=a.selectionObject,null!==d&&a.canRelinkTo()&&a.actualBounds.o()&&a.isVisible()&&d.actualBounds.o()&&d.Rf()&&
(c=a.Fk(b),null===c?(c=this.makeAdornment(d,!0),a.Rh(b,c)):c.v()));null===c&&a.Sf(b)}};lf.prototype.makeAdornment=function(a,b){var c=new Te;c.type=V.Link;b=b?this.toHandleArchetype:this.fromHandleArchetype;null!==b&&c.add(b.copy());c.adornedObject=a;return c};
lf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.hu()||!a.lastInput.left)return!1;var b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkFrom");null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkTo"));return null!==b};
lf.prototype.doActivate=function(){var a=this.diagram;if(null===this.originalLink){var b=this.handle;null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkFrom"),null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkTo")));if(null===b)return;var c=b.part;if(!(c instanceof Te&&c.adornedPart instanceof R))return;this.handle=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.Ca(this.name);a.isMouseCaptured=!0;a.currentCursor=this.linkingCursor;
this.originalFromPort=this.originalLink.fromPort;this.originalFromNode=this.originalLink.fromNode;this.originalToPort=this.originalLink.toPort;this.originalToNode=this.originalLink.toNode;this.Tx.set(this.originalLink.actualBounds);null!==this.originalLink&&0<this.originalLink.pointsCount&&(null===this.originalLink.fromNode&&(null!==this.temporaryFromPort&&(this.temporaryFromPort.desiredSize=Wb),null!==this.temporaryFromNode&&(this.temporaryFromNode.location=this.originalLink.i(0))),null===this.originalLink.toNode&&
(null!==this.temporaryToPort&&(this.temporaryToPort.desiredSize=Wb),null!==this.temporaryToNode&&(this.temporaryToNode.location=this.originalLink.i(this.originalLink.pointsCount-1))));this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,!1);this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0);a.add(this.temporaryFromNode);a.add(this.temporaryToNode);null!==this.temporaryLink&&(null!==
this.temporaryFromNode&&(this.temporaryLink.fromNode=this.temporaryFromNode),null!==this.temporaryToNode&&(this.temporaryLink.toNode=this.temporaryToNode),this.copyLinkProperties(this.originalLink,this.temporaryLink),this.temporaryLink.Za(),a.add(this.temporaryLink));this.isActive=!0};
lf.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.adjusting=a.adjusting;b.corner=a.corner;var c=a.curve;if(c===mg||c===ng)c=og;b.curve=c;b.curviness=a.curviness;b.isTreeLink=a.isTreeLink;b.points=a.points;b.routing=a.routing;b.smoothness=a.smoothness;b.fromSpot=a.fromSpot;b.fromEndSegmentLength=a.fromEndSegmentLength;b.fromShortLength=a.fromShortLength;b.toSpot=a.toSpot;b.toEndSegmentLength=a.toEndSegmentLength;b.toShortLength=a.toShortLength}};
lf.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.remove(this.temporaryLink);a.remove(this.temporaryFromNode);a.remove(this.temporaryToNode);a.isMouseCaptured=!1;a.currentCursor="";this.Vg()};lf.prototype.doStop=function(){Xf.prototype.doStop.call(this);this.handle=null};
lf.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;this.transactionResult=null;var b=this.originalFromNode,c=this.originalFromPort,d=this.originalToNode,e=this.originalToPort,f=this.originalLink;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort){var g=this.targetPort.part;g instanceof U&&(this.isForwards?(d=g,e=this.targetPort):(b=g,c=this.targetPort))}else this.isUnconnectedLinkValid?this.isForwards?e=d=null:c=b=null:f=null;null!==f?(this.reconnectLink(f,
this.isForwards?d:b,this.isForwards?e:c,this.isForwards),null===this.targetPort&&(this.isForwards?f.defaultToPoint=a.lastInput.documentPoint:f.defaultFromPoint=a.lastInput.documentPoint,f.Za()),a.allowSelect&&(f.isSelected=!0),this.transactionResult=this.name,a.U("LinkRelinked",f,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards);this.originalLink.$q(this.Tx)}this.stopTool()};
lf.prototype.reconnectLink=function(a,b,c,d){c=null!==c&&null!==c.portId?c.portId:"";d?(a.toNode=b,a.toPortId=c):(a.fromNode=b,a.fromPortId=c);return!0};lf.prototype.doNoRelink=function(){};
function Lf(a,b,c,d,e){null!==b?(a.copyPortProperties(b,c,a.temporaryFromNode,a.temporaryFromPort,!1),a.diagram.add(a.temporaryFromNode)):a.diagram.remove(a.temporaryFromNode);null!==d?(a.copyPortProperties(d,e,a.temporaryToNode,a.temporaryToPort,!0),a.diagram.add(a.temporaryToNode)):a.diagram.remove(a.temporaryToNode)}
ma.Object.defineProperties(lf.prototype,{fromHandleArchetype:{configurable:!0,get:function(){return this.W},set:function(a){null!==a&&x(a,N,lf,"fromHandleArchetype");this.W=a}},toHandleArchetype:{configurable:!0,get:function(){return this.qn},set:function(a){null!==a&&x(a,N,lf,"toHandleArchetype");this.qn=a}},handle:{configurable:!0,get:function(){return this.L},set:function(a){if(null!==a&&(x(a,N,lf,"handle"),!(a.part instanceof Te)))throw Error("new handle is not in an Adornment: "+
a);this.L=a}}});lf.className="RelinkingTool";Sa("linkingTool",function(){return this.findTool("Linking")},function(a){this.eb("Linking",a,this.mouseMoveTools)});Sa("relinkingTool",function(){return this.findTool("Relinking")},function(a){this.eb("Relinking",a,this.mouseDownTools)});
function pg(){0<arguments.length&&za(pg);Oe.call(this);this.name="LinkReshaping";var a=new Yf;a.figure="Rectangle";a.desiredSize=Yb;a.fill="lightblue";a.stroke="dodgerblue";this.w=a;a=new Yf;a.figure="Diamond";a.desiredSize=$b;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="move";this.L=a;this.W=3;this.Iu=this.l=null;this.Ux=new J;this.Xs=new H}la(pg,Oe);pg.prototype.mw=function(a){return a&&a.dt&&0!==a.dt.value?a.dt:qg};
pg.prototype.kn=function(a,b){x(a,N,pg,"setReshapingBehavior:obj");hb(b,pg,pg,"setReshapingBehavior:behavior");a.dt=b};
pg.prototype.updateAdornments=function(a){if(null!==a&&a instanceof R){var b=null;if(a.isSelected&&!this.diagram.isReadOnly){var c=a.path;null!==c&&a.canReshape()&&a.actualBounds.o()&&a.isVisible()&&c.actualBounds.o()&&c.Rf()&&(b=a.Fk(this.name),null===b||b.Qx!==a.pointsCount||b.gy!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.Qx=a.pointsCount,b.gy=a.resegmentable,a.Rh(this.name,b)))}null===b&&a.Sf(this.name)}};
pg.prototype.makeAdornment=function(a){var b=a.part,c=b.pointsCount,d=b.isOrthogonal,e=null;if(null!==b.points&&1<c){e=new Te;e.type=V.Link;c=b.firstPickIndex;var f=b.lastPickIndex,g=d?1:0;if(b.resegmentable&&b.computeCurve()!==rg)for(var h=c+g;h<f-g;h++){var k=this.makeResegmentHandle(a,h);null!==k&&(k.segmentIndex=h,k.segmentFraction=.5,k.fromMaxLinks=999,e.add(k))}for(g=c+1;g<f;g++)if(h=this.makeHandle(a,g),null!==h){h.segmentIndex=g;if(g!==c)if(g===c+1&&d){k=b.i(c);var l=b.i(c+1);K.C(k.x,l.x)&&
K.C(k.y,l.y)&&(l=b.i(c-1));K.C(k.x,l.x)?(this.kn(h,sg),h.cursor="n-resize"):K.C(k.y,l.y)&&(this.kn(h,tg),h.cursor="w-resize")}else g===f-1&&d?(k=b.i(f-1),l=b.i(f),K.C(k.x,l.x)&&K.C(k.y,l.y)&&(k=b.i(f+1)),K.C(k.x,l.x)?(this.kn(h,sg),h.cursor="n-resize"):K.C(k.y,l.y)&&(this.kn(h,tg),h.cursor="w-resize")):g!==f&&(this.kn(h,ug),h.cursor="move");e.add(h)}e.adornedObject=a}return e};pg.prototype.makeHandle=function(){var a=this.handleArchetype;return null===a?null:a.copy()};
pg.prototype.makeResegmentHandle=function(){var a=this.midHandleArchetype;return null===a?null:a.copy()};pg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowReshape&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
pg.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null!==this.handle){var b=this.handle.part.adornedPart;if(b instanceof R){this.Iu=b;a.isMouseCaptured=!0;this.Ca(this.name);if(b.resegmentable&&999===this.handle.fromMaxLinks){var c=b.points.copy(),d=this.getResegmentingPoint();c.Ab(this.handle.segmentIndex+1,d);b.isOrthogonal&&c.Ab(this.handle.segmentIndex+1,d);b.points=c;b.Rb();b.updateAdornments();
this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name);if(null===this.handle){this.doDeactivate();return}}this.Ux=b.i(this.handle.segmentIndex);this.Xs=b.points.copy();this.isActive=!0}}};pg.prototype.doDeactivate=function(){this.Vg();this.Iu=this.handle=null;this.isActive=this.diagram.isMouseCaptured=!1};pg.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.Xs);this.stopTool()};pg.prototype.getResegmentingPoint=function(){return this.handle.ma(Mc)};
pg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeReshape(a.lastInput.documentPoint),this.reshape(a))};
pg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.computeReshape(a.lastInput.documentPoint);this.reshape(b);b=this.adornedLink;if(null!==b&&b.resegmentable){var c=this.handle.segmentIndex,d=b.i(c-1),e=b.i(c),f=b.i(c+1);if(b.isOrthogonal){if(c>b.firstPickIndex+1&&c<b.lastPickIndex-1){var g=b.i(c-2);if(Math.abs(d.x-e.x)<this.resegmentingDistance&&Math.abs(d.y-e.y)<this.resegmentingDistance&&(vg(this,g,d,e,f,!0)||vg(this,g,d,e,f,!1))){var h=b.points.copy();vg(this,g,d,
e,f,!0)?(h.td(c-2,new J(g.x,(f.y+g.y)/2)),h.td(c+1,new J(f.x,(f.y+g.y)/2))):(h.td(c-2,new J((f.x+g.x)/2,g.y)),h.td(c+1,new J((f.x+g.x)/2,f.y)));h.ib(c);h.ib(c-1);b.points=h;b.Rb()}else g=b.i(c+2),Math.abs(e.x-f.x)<this.resegmentingDistance&&Math.abs(e.y-f.y)<this.resegmentingDistance&&(vg(this,d,e,f,g,!0)||vg(this,d,e,f,g,!1))&&(h=b.points.copy(),vg(this,d,e,f,g,!0)?(h.td(c-1,new J(d.x,(d.y+g.y)/2)),h.td(c+2,new J(g.x,(d.y+g.y)/2))):(h.td(c-1,new J((d.x+g.x)/2,d.y)),h.td(c+2,new J((d.x+g.x)/2,g.y))),
h.ib(c+1),h.ib(c),b.points=h,b.Rb())}}else g=J.alloc(),K.ai(d.x,d.y,f.x,f.y,e.x,e.y,g)&&g.Se(e)<this.resegmentingDistance*this.resegmentingDistance&&(d=b.points.copy(),d.ib(c),b.points=d,b.Rb()),J.free(g)}a.Ua();this.transactionResult=this.name;a.U("LinkReshaped",this.adornedLink,this.Xs)}this.stopTool()};
function vg(a,b,c,d,e,f){return f?Math.abs(b.y-c.y)<a.resegmentingDistance&&Math.abs(c.y-d.y)<a.resegmentingDistance&&Math.abs(d.y-e.y)<a.resegmentingDistance:Math.abs(b.x-c.x)<a.resegmentingDistance&&Math.abs(c.x-d.x)<a.resegmentingDistance&&Math.abs(d.x-e.x)<a.resegmentingDistance}
pg.prototype.reshape=function(a){var b=this.adornedLink;b.di();var c=this.handle.segmentIndex,d=this.mw(this.handle);if(b.isOrthogonal)if(c===b.firstPickIndex+1)c=b.firstPickIndex+1,d===sg?(b.N(c,b.i(c-1).x,a.y),b.N(c+1,b.i(c+2).x,a.y)):d===tg&&(b.N(c,a.x,b.i(c-1).y),b.N(c+1,a.x,b.i(c+2).y));else if(c===b.lastPickIndex-1)c=b.lastPickIndex-1,d===sg?(b.N(c-1,b.i(c-2).x,a.y),b.N(c,b.i(c+1).x,a.y)):d===tg&&(b.N(c-1,a.x,b.i(c-2).y),b.N(c,a.x,b.i(c+1).y));else{d=c;var e=b.i(d),f=b.i(d-1),g=b.i(d+1);K.C(f.x,
e.x)&&K.C(e.y,g.y)?(K.C(f.x,b.i(d-2).x)&&!K.C(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.N(d-1,a.x,f.y),K.C(g.y,b.i(d+2).y)&&!K.C(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.N(d+1,g.x,a.y)):K.C(f.y,e.y)&&K.C(e.x,g.x)?(K.C(f.y,b.i(d-2).y)&&!K.C(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.N(d-1,f.x,a.y),K.C(g.x,b.i(d+2).x)&&!K.C(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.N(d+1,a.x,g.y)):K.C(f.x,e.x)&&K.C(e.x,g.x)?(K.C(f.x,b.i(d-2).x)&&!K.C(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.N(d-1,a.x,f.y),K.C(g.x,b.i(d+2).x)&&
!K.C(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.N(d+1,a.x,g.y)):K.C(f.y,e.y)&&K.C(e.y,g.y)&&(K.C(f.y,b.i(d-2).y)&&!K.C(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.N(d-1,f.x,a.y),K.C(g.y,b.i(d+2).y)&&!K.C(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.N(d+1,g.x,a.y));b.N(c,a.x,a.y)}else b.N(c,a.x,a.y),d=b.fromNode,e=b.fromPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),1===c&&b.computeSpot(!0,e).Sb()&&(f=e.ma(Mc,J.alloc()),d=b.getLinkPointFromPoint(d,e,f,a,!0,J.alloc()),b.N(0,d.x,d.y),J.free(f),
J.free(d)),d=b.toNode,e=b.toPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),c===b.pointsCount-2&&b.computeSpot(!1,e).Sb()&&(c=e.ma(Mc,J.alloc()),a=b.getLinkPointFromPoint(d,e,c,a,!1,J.alloc()),b.N(b.pointsCount-1,a.x,a.y),J.free(c),J.free(a));b.Jf()};pg.prototype.computeReshape=function(a){var b=this.adornedLink,c=this.handle.segmentIndex;switch(this.mw(this.handle)){case ug:return a;case sg:return new J(b.i(c).x,a.y);case tg:return new J(a.x,b.i(c).y);default:case qg:return b.i(c)}};
ma.Object.defineProperties(pg.prototype,{handleArchetype:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&x(a,N,pg,"handleArchetype");this.w=a}},midHandleArchetype:{configurable:!0,get:function(){return this.L},set:function(a){null!==a&&x(a,N,pg,"midHandleArchetype");this.L=a}},handle:{configurable:!0,get:function(){return this.l},set:function(a){if(null!==a&&(x(a,N,pg,"handle"),!(a.part instanceof Te)))throw Error("new handle is not in an Adornment: "+
a);this.l=a}},adornedLink:{configurable:!0,get:function(){return this.Iu}},resegmentingDistance:{configurable:!0,get:function(){return this.W},set:function(a){A(a,"number",pg,"resegmentingDistance");this.W=a}},originalPoint:{configurable:!0,get:function(){return this.Ux}},originalPoints:{configurable:!0,get:function(){return this.Xs}}});pg.prototype.setReshapingBehavior=pg.prototype.kn;pg.prototype.getReshapingBehavior=pg.prototype.mw;
var qg=new E(pg,"None",0),tg=new E(pg,"Horizontal",1),sg=new E(pg,"Vertical",2),ug=new E(pg,"All",3);pg.className="LinkReshapingTool";pg.None=qg;pg.Horizontal=tg;pg.Vertical=sg;pg.All=ug;Sa("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(a){this.eb("LinkReshaping",a,this.mouseDownTools)});
function Ig(){0<arguments.length&&za(Ig);Oe.call(this);this.name="Resizing";this.rg=(new Hb(1,1)).freeze();this.qg=(new Hb(9999,9999)).freeze();this.bh=(new Hb(NaN,NaN)).freeze();this.L=!1;this.W=!0;this.ne=null;var a=new Yf;a.alignmentFocus=Mc;a.figure="Rectangle";a.desiredSize=Yb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.w=a;this.l=null;this.Ws=new J;this.Sx=new Hb;this.Ap=new J;this.Zu=new Hb(0,0);this.Yu=new Hb(Infinity,Infinity);this.Xu=new Hb(1,1);this.Px=
!0}la(Ig,Oe);Ig.prototype.updateAdornments=function(a){if(!(null===a||a instanceof R)){if(a.isSelected&&!this.diagram.isReadOnly){var b=a.resizeObject,c=a.Fk(this.name);if(null!==b&&a.canResize()&&a.actualBounds.o()&&a.isVisible()&&b.actualBounds.o()&&b.Rf()){if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){b=b.wj();Jg(a)&&this.updateResizeHandles(c,b);a.Rh(this.name,c);return}}}a.Sf(this.name)}};
Ig.prototype.makeAdornment=function(a){var b=a.part.resizeAdornmentTemplate;if(null===b){b=new Te;b.type=V.Spot;b.locationSpot=Mc;var c=new Kg;c.isPanelMain=!0;b.add(c);b.add(this.makeHandle(a,Hc));b.add(this.makeHandle(a,Jc));b.add(this.makeHandle(a,Sc));b.add(this.makeHandle(a,Oc));b.add(this.makeHandle(a,qd));b.add(this.makeHandle(a,sd));b.add(this.makeHandle(a,td));b.add(this.makeHandle(a,rd))}else if(Lg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};
Ig.prototype.makeHandle=function(a,b){a=this.handleArchetype;if(null===a)return null;a=a.copy();a.alignment=b;return a};
Ig.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Ib()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.Sb()&&(c=Mc);if(0>=c.x)b=0>=c.y?b+225:1<=c.y?b+135:b+180;else if(1<=c.x)0>=c.y?b+=315:1<=c.y&&(b+=45);else if(0>=c.y)b+=270;else if(1<=c.y)b+=90;else break a;0>b?b+=360:360<=b&&(b-=360);a.cursor=22.5>b?"e-resize":67.5>b?"se-resize":112.5>b?"s-resize":157.5>b?"sw-resize":202.5>b?"w-resize":247.5>b?"nw-resize":292.5>b?"n-resize":337.5>b?"ne-resize":
"e-resize"}else if(a instanceof V)for(a=a.elements;a.next();)this.updateResizeHandles(a.value,b)};Ig.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowResize&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
Ig.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));null!==this.handle&&(this.adornedObject=this.handle.part.adornedObject,null!==this.adornedObject&&(a.isMouseCaptured=!0,this.Px=a.animationManager.isEnabled,a.animationManager.isEnabled=!1,this.Ca(this.name),this.Ws.set(this.adornedObject.ma(this.handle.alignment.yw())),this.Ap.set(this.adornedObject.part.location),this.Sx.set(this.adornedObject.desiredSize),
this.Xu=this.computeCellSize(),this.Zu=this.computeMinSize(),this.Yu=this.computeMaxSize(),this.isActive=!0))};Ig.prototype.doDeactivate=function(){var a=this.diagram;this.Vg();this.ne=this.handle=null;this.isActive=a.isMouseCaptured=!1;a.animationManager.isEnabled=this.Px};Ig.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()};
Ig.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.Zu,c=this.Yu,d=this.Xu,e=this.adornedObject.$t(a.lastInput.documentPoint,J.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.jd();J.free(e)}};
Ig.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.Zu,c=this.Yu,d=this.Xu,e=this.adornedObject.$t(a.lastInput.documentPoint,J.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);J.free(e);a.Ua();this.transactionResult=this.name;a.U("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()};
Ig.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject;if(null!==c){c.desiredSize=a.size;a=c.part;a.Ya();c=c.ma(this.handle.alignment.yw());if(a instanceof Hf){var d=new H;d.add(a);if(!this.dragsMembers&&null===a.placeholder){var e=new ef;e.dragsMembers=!1}b.moveParts(d,this.oppositePoint.copy().ke(c),!0,e)}else a.location=a.location.copy().ke(c).add(this.oppositePoint);b.jd()}};
Ig.prototype.computeResize=function(a,b,c,d,e,f){b.Sb()&&(b=Mc);var g=this.adornedObject.naturalBounds,h=g.x,k=g.y,l=g.x+g.width,m=g.y+g.height,n=1;if(!f){n=g.width;var p=g.height;0>=n&&(n=1);0>=p&&(p=1);n=p/n}p=J.alloc();K.Rq(a.x,a.y,h,k,e.width,e.height,p);a=g.copy();0>=b.x?0>=b.y?(a.x=Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=Math.max(l-a.x,c.width),a.y=Math.max(p.y,m-d.height),a.y=Math.min(a.y,m-c.height),a.height=Math.max(m-a.y,c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*
a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),a.x=l-a.width,a.y=m-a.height)):1<=b.y?(a.x=Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=Math.max(l-a.x,c.width),a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),a.x=l-a.width)):(a.x=
Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=l-a.x,f||(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n,a.y=k+.5*(m-k-a.height))):1<=b.x?0>=b.y?(a.width=Math.max(Math.min(p.x-h,d.width),c.width),a.y=Math.max(p.y,m-d.height),a.y=Math.min(a.y,m-c.height),a.height=Math.max(m-a.y,c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),
a.y=m-a.height)):1<=b.y?(a.width=Math.max(Math.min(p.x-h,d.width),c.width),a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width))):(a.width=Math.max(Math.min(p.x-h,d.width),c.width),f||(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n,a.y=k+.5*(m-k-a.height))):0>=b.y?(a.y=Math.max(p.y,m-d.height),
a.y=Math.min(a.y,m-c.height),a.height=m-a.y,f||(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width,a.x=h+.5*(l-h-a.width))):1<=b.y&&(a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width,a.x=h+.5*(l-h-a.width)));J.free(p);return a};Ig.prototype.computeReshape=function(){var a=Mg;this.adornedObject instanceof Yf&&(a=Ng(this.adornedObject));return!(a===Og||this.diagram.lastInput.shift)};
Ig.prototype.computeMinSize=function(){var a=this.adornedObject.minSize.copy(),b=this.minSize;!isNaN(b.width)&&b.width>a.width&&(a.width=b.width);!isNaN(b.height)&&b.height>a.height&&(a.height=b.height);return a};Ig.prototype.computeMaxSize=function(){var a=this.adornedObject.maxSize.copy(),b=this.maxSize;!isNaN(b.width)&&b.width<a.width&&(a.width=b.width);!isNaN(b.height)&&b.height<a.height&&(a.height=b.height);return a};
Ig.prototype.computeCellSize=function(){var a=new Hb(NaN,NaN),b=this.adornedObject.part;null!==b&&(b=b.resizeCellSize,!isNaN(b.width)&&0<b.width&&(a.width=b.width),!isNaN(b.height)&&0<b.height&&(a.height=b.height));b=this.cellSize;isNaN(a.width)&&!isNaN(b.width)&&0<b.width&&(a.width=b.width);isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height);b=this.diagram;(isNaN(a.width)||isNaN(a.height))&&b&&(b=b.grid,null!==b&&b.visible&&this.isGridSnapEnabled&&(b=b.gridCellSize,isNaN(a.width)&&
!isNaN(b.width)&&0<b.width&&(a.width=b.width),isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height)));if(isNaN(a.width)||0===a.width||Infinity===a.width)a.width=1;if(isNaN(a.height)||0===a.height||Infinity===a.height)a.height=1;return a};
ma.Object.defineProperties(Ig.prototype,{handleArchetype:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&x(a,N,Ig,"handleArchetype");this.w=a}},handle:{configurable:!0,get:function(){return this.l},set:function(a){if(null!==a&&(x(a,N,Ig,"handle"),!(a.part instanceof Te)))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{configurable:!0,get:function(){return this.ne},set:function(a){if(null!==a&&(x(a,N,
Ig,"handle"),a.part instanceof Te))throw Error("new handle must not be in an Adornment: "+a);this.ne=a}},minSize:{configurable:!0,get:function(){return this.rg},set:function(a){x(a,Hb,Ig,"minSize");if(!this.rg.A(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.rg.h(b,a)}}},maxSize:{configurable:!0,get:function(){return this.qg},set:function(a){x(a,Hb,Ig,"maxSize");if(!this.qg.A(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity);
this.qg.h(b,a)}}},cellSize:{configurable:!0,get:function(){return this.bh},set:function(a){x(a,Hb,Ig,"cellSize");this.bh.A(a)||this.bh.assign(a)}},isGridSnapEnabled:{configurable:!0,get:function(){return this.L},set:function(a){A(a,"boolean",Ig,"isGridSnapEnabled");this.L=a}},dragsMembers:{configurable:!0,get:function(){return this.W},set:function(a){A(a,"boolean",Ig,"dragsMembers");this.W=a}},oppositePoint:{configurable:!0,get:function(){return this.Ws},
set:function(a){x(a,J,Ig,"oppositePoint");this.Ws.A(a)||this.Ws.assign(a)}},originalDesiredSize:{configurable:!0,get:function(){return this.Sx}},originalLocation:{configurable:!0,get:function(){return this.Ap}}});Ig.className="ResizingTool";Sa("resizingTool",function(){return this.findTool("Resizing")},function(a){this.eb("Resizing",a,this.mouseDownTools)});
function Pg(){0<arguments.length&&za(Pg);Oe.call(this);this.name="Rotating";this.Pa=45;this.Oa=2;this.Ap=new J;this.ne=null;var a=new Yf;a.figure="Ellipse";a.desiredSize=$b;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.w=a;this.l=null;this.Rx=0;this.zv=new J(NaN,NaN);this.L=0;this.W=50}la(Pg,Oe);
Pg.prototype.updateAdornments=function(a){if(null!==a){if(a.$h()){var b=a.rotateObject;if(b===a||b===a.path||b.isPanelMain)return}if(a.isSelected&&!this.diagram.isReadOnly&&(b=a.rotateObject,null!==b&&a.canRotate()&&a.actualBounds.o()&&a.isVisible()&&b.actualBounds.o()&&b.Rf())){var c=a.Fk(this.name);if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.wj();null===c.placeholder&&(c.location=this.computeAdornmentLocation(b));a.Rh(this.name,c);return}}a.Sf(this.name)}};
Pg.prototype.makeAdornment=function(a){var b=a.part.rotateAdornmentTemplate;if(null===b){b=new Te;b.type=V.Position;b.locationSpot=Mc;var c=this.handleArchetype;null!==c&&b.add(c.copy())}else if(Lg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};Pg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowRotate&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
Pg.prototype.doActivate=function(){var a=this.diagram;if(null===this.adornedObject){null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null===this.handle)return;this.adornedObject=this.handle.part.adornedObject}null!==this.adornedObject&&(a.isMouseCaptured=!0,a.delaysLayout=!0,this.Ca(this.name),this.Rx=this.adornedObject.angle,this.zv=this.computeRotationPoint(this.adornedObject),this.Ap=this.adornedObject.part.location.copy(),this.isActive=!0)};
Pg.prototype.computeRotationPoint=function(a){var b=a.part,c=b.locationObject;return b.rotationSpot.cb()?a.ma(b.rotationSpot):a===b||a===c?c.ma(b.locationSpot):a.ma(Mc)};
Pg.prototype.computeAdornmentLocation=function(a){var b=this.rotationPoint;b.o()||(b=this.computeRotationPoint(a));b=a.$t(b);var c=this.handleAngle;0>c?c+=360:360<=c&&(c-=360);c=Math.round(45*Math.round(c/45));var d=this.handleDistance;0===c?b.x=a.naturalBounds.width+d:45===c?(b.x=a.naturalBounds.width+d,b.y=a.naturalBounds.height+d):90===c?b.y=a.naturalBounds.height+d:135===c?(b.x=-d,b.y=a.naturalBounds.height+d):180===c?b.x=-d:225===c?(b.x=-d,b.y=-d):270===c?b.y=-d:315===c&&(b.x=a.naturalBounds.width+
d,b.y=-d);return a.ma(b)};Pg.prototype.doDeactivate=function(){var a=this.diagram;this.Vg();this.ne=this.handle=null;this.zv=new J(NaN,NaN);this.isActive=a.isMouseCaptured=!1};Pg.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};Pg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))};
Pg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Ua();this.transactionResult=this.name;a.U("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()};
Pg.prototype.rotate=function(a){F&&C(a,Pg,"rotate:newangle");var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.Ya();var c=b.locationObject,d=b.rotateObject;if(c===d||c.Sg(d))c=this.Ap.copy(),b.location=c.ke(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint);this.diagram.jd()}};
Pg.prototype.computeRotate=function(a){a=this.rotationPoint.Xa(a)-this.handleAngle;var b=this.adornedObject.panel;null!==b&&(a-=b.wj());360<=a?a-=360:0>a&&(a+=360);b=Math.min(Math.abs(this.snapAngleMultiple),180);var c=Math.min(Math.abs(this.snapAngleEpsilon),b/2);!this.diagram.lastInput.shift&&0<b&&0<c&&(a%b<c?a=Math.floor(a/b)*b:a%b>b-c&&(a=(Math.floor(a/b)+1)*b));360<=a?a-=360:0>a&&(a+=360);return a};
ma.Object.defineProperties(Pg.prototype,{handleArchetype:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&x(a,N,Pg,"handleArchetype");this.w=a}},handle:{configurable:!0,get:function(){return this.l},set:function(a){if(null!==a&&(x(a,N,Pg,"handle"),!(a.part instanceof Te)))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{configurable:!0,get:function(){return this.ne},set:function(a){if(null!==a&&(x(a,N,
Pg,"handle"),a.part instanceof Te))throw Error("new handle must not be in an Adornment: "+a);this.ne=a}},snapAngleMultiple:{configurable:!0,get:function(){return this.Pa},set:function(a){A(a,"number",Pg,"snapAngleMultiple");this.Pa=a}},snapAngleEpsilon:{configurable:!0,get:function(){return this.Oa},set:function(a){A(a,"number",Pg,"snapAngleEpsilon");this.Oa=a}},originalAngle:{configurable:!0,get:function(){return this.Rx}},rotationPoint:{configurable:!0,
enumerable:!0,get:function(){return this.zv}},handleAngle:{configurable:!0,get:function(){return this.L},set:function(a){A(a,"number",Pg,"handleAngle");this.L=a}},handleDistance:{configurable:!0,get:function(){return this.W},set:function(a){A(a,"number",Pg,"handleDistance");this.W=a}}});Pg.className="RotatingTool";Sa("rotatingTool",function(){return this.findTool("Rotating")},function(a){this.eb("Rotating",a,this.mouseDownTools)});
function Qg(){Oe.call(this);0<arguments.length&&za(Qg);this.name="ClickSelecting"}la(Qg,Oe);Qg.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0};Qg.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};Qg.className="ClickSelectingTool";function Rg(){Oe.call(this);0<arguments.length&&za(Rg);this.name="Action";this.al=null}
la(Rg,Oe);Rg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.$b(b.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a});if(null!==c){if(!c.isActionable)return!1;this.al=c;a.Nj=a.$b(b.documentPoint,null,null);return!0}return!1};Rg.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.al;null!==b&&(a.targetObject=b,null!==b.actionDown&&b.actionDown(a,b))}else this.canStart()&&this.doActivate()};
Rg.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.al;null!==b&&(a.targetObject=b,null!==b.actionMove&&b.actionMove(a,b))}};Rg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.al;if(null===b)return;a.targetObject=b;null!==b.actionUp&&b.actionUp(a,b);this.standardMouseClick(function(a){for(;null!==a.panel&&(!a.isActionable||a!==b);)a=a.panel;return a},function(a){return a===b})}this.stopTool()};
Rg.prototype.doCancel=function(){var a=this.diagram.lastInput,b=this.al;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};Rg.prototype.doStop=function(){this.al=null};Rg.className="ActionTool";function Sg(){Oe.call(this);0<arguments.length&&za(Sg);this.name="ClickCreating";this.Jj=null;this.w=!0;this.l=!1;this.Jx=new J(0,0)}la(Sg,Oe);
Sg.prototype.canStart=function(){if(!this.isEnabled||null===this.archetypeNodeData)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.lastInput.left||this.isBeyondDragSize())return!1;if(this.isDoubleClick){if(1===a.lastInput.clickCount&&(this.Jx=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.Jx))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.Im(a.lastInput.documentPoint,!0)?!1:!0};
Sg.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()};
Sg.prototype.insertPart=function(a){var b=this.diagram,c=this.archetypeNodeData;if(null===c)return null;var d=null;try{b.U("ChangingSelection",b.selection);this.Ca(this.name);if(c instanceof S)c.bc()&&(Lg(c),d=c.copy(),null!==d&&b.add(d));else if(null!==c){var e=b.model.copyNodeData(c);Fa(e)&&(b.model.Gf(e),d=b.Ec(e))}if(null!==d){var f=J.allocAt(a.x,a.y);this.isGridSnapEnabled&&Tg(this.diagram,d,a,f);d.location=f;b.allowSelect&&(b.clearSelection(!0),d.isSelected=!0);J.free(f)}b.Ua();this.transactionResult=
this.name;b.U("PartCreated",d)}finally{this.Vg(),b.U("ChangedSelection",b.selection)}return d};
ma.Object.defineProperties(Sg.prototype,{archetypeNodeData:{configurable:!0,get:function(){return this.Jj},set:function(a){null!==a&&A(a,"object",Sg,"archetypeNodeData");this.Jj=a}},isDoubleClick:{configurable:!0,get:function(){return this.w},set:function(a){A(a,"boolean",Sg,"isDoubleClick");this.w=a}},isGridSnapEnabled:{configurable:!0,get:function(){return this.l},set:function(a){A(a,"boolean",Sg,"isGridSnapEnabled");this.l=a}}});Sg.className="ClickCreatingTool";
function Ug(){Oe.call(this);0<arguments.length&&za(Ug);this.name="DragSelecting";this.ul=175;this.w=!1;var a=new S;a.layerName="Tool";a.selectable=!1;var b=new Yf;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.l=a}la(Ug,Oe);
Ug.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(!a.allowSelect)return!1;var b=a.lastInput;return!b.left||a.currentTool!==this&&(!this.isBeyondDragSize()||b.timestamp-a.firstInput.timestamp<this.delay||null!==a.Im(b.documentPoint,!0))?!1:!0};Ug.prototype.doActivate=function(){var a=this.diagram;this.isActive=!0;a.isMouseCaptured=!0;a.skipsUndoManager=!0;a.add(this.box);this.doMouseMove()};
Ug.prototype.doDeactivate=function(){var a=this.diagram;a.Uf();a.remove(this.box);a.skipsUndoManager=!1;this.isActive=a.isMouseCaptured=!1};Ug.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive&&null!==this.box){var b=this.computeBoxBounds(),c=this.box.gb("SHAPE");null===c&&(c=this.box.ub());var d=Hb.alloc().h(b.width,b.height);b=J.allocAt(b.x,b.y);c.desiredSize=d;this.box.position=b;Hb.free(d);J.free(b);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.St(a.lastInput.viewPoint)}};
Ug.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;a.remove(this.box);try{a.currentCursor="wait",a.U("ChangingSelection",a.selection),this.selectInRect(this.computeBoxBounds()),a.U("ChangedSelection",a.selection)}finally{a.currentCursor=""}}this.stopTool()};Ug.prototype.computeBoxBounds=function(){var a=this.diagram;return new L(a.firstInput.documentPoint,a.lastInput.documentPoint)};
Ug.prototype.selectInRect=function(a){var b=this.diagram,c=b.lastInput;a=b.Fy(a,this.isPartialInclusion);if(db?c.meta:c.control)if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected&&(b.isSelected=!1);else for(a=a.iterator;a.next();)b=a.value,b.isSelected=!b.isSelected;else if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0);else{c=new H;for(b=b.selection.iterator;b.next();){var d=b.value;a.contains(d)||c.add(d)}for(b=c.iterator;b.next();)b.value.isSelected=!1;for(a=
a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0)}};ma.Object.defineProperties(Ug.prototype,{delay:{configurable:!0,get:function(){return this.ul},set:function(a){A(a,"number",Ug,"delay");this.ul=a}},isPartialInclusion:{configurable:!0,get:function(){return this.w},set:function(a){A(a,"boolean",Ug,"isPartialInclusion");this.w=a}},box:{configurable:!0,get:function(){return this.l},set:function(a){null!==a&&x(a,S,Ug,"box");this.l=a}}});
Ug.className="DragSelectingTool";function Vg(){Oe.call(this);0<arguments.length&&za(Vg);this.name="Panning";this.wv=new J;this.xz=new J;this.ah=!1;var a=this;this.Xx=function(){var b=a.diagram;null!==b&&b.removeEventListener(qa.document,"scroll",a.Xx,!1);a.stopTool()}}la(Vg,Oe);Vg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.allowHorizontalScroll&&!a.allowVerticalScroll||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:!0};
Vg.prototype.doActivate=function(){var a=this.diagram;this.ah?(a.lastInput.bubbles=!0,a.addEventListener(qa.document,"scroll",this.Xx,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.wv.assign(a.position));this.isActive=!0};Vg.prototype.doDeactivate=function(){var a=this.diagram;a.currentCursor="";this.isActive=a.isMouseCaptured=!1};Vg.prototype.doCancel=function(){var a=this.diagram;a.position=this.wv;a.isMouseCaptured=!1;this.stopTool()};Vg.prototype.doMouseMove=function(){this.move()};
Vg.prototype.doMouseUp=function(){this.move();this.stopTool()};Vg.prototype.move=function(){var a=this.diagram;if(this.isActive&&a)if(this.ah)a.lastInput.bubbles=!0;else{var b=a.position,c=a.firstInput.documentPoint,d=a.lastInput.documentPoint,e=b.x+c.x-d.x;c=b.y+c.y-d.y;a.allowHorizontalScroll||(e=b.x);a.allowVerticalScroll||(c=b.y);a.position=this.xz.h(e,c)}};
ma.Object.defineProperties(Vg.prototype,{bubbles:{configurable:!0,get:function(){return this.ah},set:function(a){A(a,"boolean",Vg,"bubbles");this.ah=a}},originalPosition:{configurable:!0,get:function(){return this.wv}}});Vg.className="PanningTool";Sa("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(a){this.eb("ClickCreating",a,this.mouseUpTools)});
Sa("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(a){this.eb("ClickSelecting",a,this.mouseUpTools)});Sa("panningTool",function(){return this.findTool("Panning")},function(a){this.eb("Panning",a,this.mouseMoveTools)});Sa("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(a){this.eb("DragSelecting",a,this.mouseMoveTools)});Sa("actionTool",function(){return this.findTool("Action")},function(a){this.eb("Action",a,this.mouseDownTools)});
function bf(){this.W=this.L=this.l=this.w=null}
ma.Object.defineProperties(bf.prototype,{mainElement:{configurable:!0,get:function(){return this.L},set:function(a){null!==a&&x(a,HTMLElement,bf,"mainElement");this.L=a}},show:{configurable:!0,get:function(){return this.w},set:function(a){this.w!==a&&(null!==a&&A(a,"function",bf,"show"),this.w=a)}},hide:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(null!==a&&A(a,"function",bf,"hide"),this.l=a)}},valueFunction:{configurable:!0,
enumerable:!0,get:function(){return this.W},set:function(a){this.W=a}}});bf.className="HTMLInfo";function Wg(a,b,c){this.text=a;this.qy=b;this.visible=c}Wg.className="ContextMenuButtonInfo";function Xg(){Oe.call(this);0<arguments.length&&za(Xg);this.name="ContextMenu";this.w=this.Ou=this.l=null;this.Ox=new J;this.Pu=null;this.jv=!1;var a=this;this.Jv=function(){a.stopTool()}}la(Xg,Oe);
function Yg(a){var b=new bf;b.show=function(a,b,c){c.showDefaultContextMenu()};b.hide=function(a,b){b.hideDefaultContextMenu()};Zg=b;a.Jv=function(){a.stopTool()};b=ua("div");var c=ua("div");b.style.cssText="top: 0px;z-index:10002;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px";c.style.cssText="z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";
var d=ua("style");qa.document.getElementsByTagName("head")[0].appendChild(d);d.sheet.insertRule(".goCXul { list-style: none; }",0);d.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0);d.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0);d=a.diagram;null!==d&&(d.addEventListener(b,"contextmenu",$g,!1),d.addEventListener(b,"selectstart",
$g,!1),d.addEventListener(c,"contextmenu",$g,!1));b.className="goCXforeground";c.className="goCXbackground";qa.document.body&&(qa.document.body.appendChild(b),qa.document.body.appendChild(c));ah=b;bh=c;ch=!0}function $g(a){a.preventDefault();return!1}
Xg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return this.isBeyondDragSize()||!a.lastInput.right||1<a.lastInput.clickCount?!1:a.lastInput.isTouchEvent&&null!==this.defaultTouchContextMenu||null!==this.findObjectWithContextMenu()?!0:!1};Xg.prototype.doStart=function(){this.Ox.set(this.diagram.firstInput.documentPoint)};Xg.prototype.doStop=function(){this.hideContextMenu();this.currentObject=null};
Xg.prototype.findObjectWithContextMenu=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.lastInput,d=null;a instanceof Q||(a instanceof N?d=a:d=b.$b(c.documentPoint,null,function(a){return!a.layer.isTemporary}));if(null!==d){for(a=d;null!==a;){if(null!==a.contextMenu)return a;a=a.panel}if(b.lastInput.isTouchEvent&&this.defaultTouchContextMenu)return d.part}else if(null!==b.contextMenu)return b;return null};Xg.prototype.doActivate=function(){};
Xg.prototype.doMouseDown=function(){Oe.prototype.doMouseDown.call(this);if(this.isActive&&this.currentContextMenu instanceof Te){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doMouseDown(),a.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&dh(this)};
Xg.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof Te){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doCancel(),a.doDeactivate())}dh(this)};
function dh(a){var b=a.diagram;if(a.isActive){var c=a.currentContextMenu;if(null!==c){if(!(c instanceof bf)){var d=b.$b(b.lastInput.documentPoint,null,null);null!==d&&d.Sg(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.currentTool=a,a.doMouseUp())}}else a.canStart()&&(eh(a,!0),a.isActive||a.stopTool())}
function eh(a,b,c){void 0===c&&(c=null);if(!a.jv&&(a.jv=!0,b&&a.standardMouseSelect(),b=a.standardMouseClick(),a.jv=!1,!b)){a.isActive=!0;b=Zg;null===c&&(c=a.findObjectWithContextMenu());if(null!==c){var d=c.contextMenu;null!==d?(a.currentObject=c instanceof N?c:null,a.showContextMenu(d,a.currentObject)):null!==b&&a.showContextMenu(b,a.currentObject)}else null!==b&&a.showContextMenu(b,null);a.currentContextMenu instanceof Te&&!a.currentContextMenu.visible&&a.stopTool()}}
Xg.prototype.doMouseMove=function(){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.doMouseMove();this.isActive&&this.diagram.toolManager.doMouseMove()};
Xg.prototype.showContextMenu=function(a,b){!F||a instanceof Te||a instanceof bf||v("showContextMenu:contextMenu must be an Adornment or HTMLInfo.");null!==b&&x(b,N,Xg,"showContextMenu:obj");var c=this.diagram;a!==this.currentContextMenu&&this.hideContextMenu();if(a instanceof Te){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category=this.name;null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?a.adornedObject=b:a.data=c.model;
a.Ya();this.positionContextMenu(a,b)}else a instanceof bf&&a.show(b,c,this);this.currentContextMenu=a};Xg.prototype.positionContextMenu=function(a){if(null===a.placeholder){var b=this.diagram,c=b.lastInput.documentPoint.copy(),d=a.measuredBounds,e=b.viewportBounds;b.lastInput.isTouchEvent&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5/b.scale);c.x<e.x&&(c.x=e.x);c.y+d.height>e.bottom&&(c.y-=d.height+5/b.scale);c.y<e.y&&(c.y=e.y);a.position=c}};
Xg.prototype.hideContextMenu=function(){var a=this.diagram,b=this.currentContextMenu;null!==b&&(b instanceof Te?(a.remove(b),null!==this.Ou&&this.Ou.Sf(b.category),b.data=null,b.adornedObject=null):b instanceof bf&&(null!==b.hide?b.hide(a,this):null!==b.mainElement&&(b.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())};
function fh(a){var b=new H;b.add(new Wg("Copy",function(a){a.commandHandler.copySelection()},function(a){return a.commandHandler.canCopySelection()}));b.add(new Wg("Cut",function(a){a.commandHandler.cutSelection()},function(a){return a.commandHandler.canCutSelection()}));b.add(new Wg("Delete",function(a){a.commandHandler.deleteSelection()},function(a){return a.commandHandler.canDeleteSelection()}));b.add(new Wg("Paste",function(b){b.commandHandler.pasteSelection(a.mouseDownPoint)},function(b){return b.commandHandler.canPasteSelection(a.mouseDownPoint)}));
b.add(new Wg("Select All",function(a){a.commandHandler.selectAll()},function(a){return a.commandHandler.canSelectAll()}));b.add(new Wg("Undo",function(a){a.commandHandler.undo()},function(a){return a.commandHandler.canUndo()}));b.add(new Wg("Redo",function(a){a.commandHandler.redo()},function(a){return a.commandHandler.canRedo()}));b.add(new Wg("Scroll To Part",function(a){a.commandHandler.scrollToPart()},function(a){return a.commandHandler.canScrollToPart()}));b.add(new Wg("Zoom To Fit",function(a){a.commandHandler.zoomToFit()},
function(a){return a.commandHandler.canZoomToFit()}));b.add(new Wg("Reset Zoom",function(a){a.commandHandler.resetZoom()},function(a){return a.commandHandler.canResetZoom()}));b.add(new Wg("Group Selection",function(a){a.commandHandler.groupSelection()},function(a){return a.commandHandler.canGroupSelection()}));b.add(new Wg("Ungroup Selection",function(a){a.commandHandler.ungroupSelection()},function(a){return a.commandHandler.canUngroupSelection()}));b.add(new Wg("Edit Text",function(a){a.commandHandler.editTextBlock()},
function(a){return a.commandHandler.canEditTextBlock()}));return b}
Xg.prototype.showDefaultContextMenu=function(){var a=this.diagram;null===this.Pu&&(this.Pu=fh(this));ah.innerHTML="";bh.addEventListener("click",this.Jv,!1);var b=this,c=ua("ul");c.className="goCXul";ah.appendChild(c);c.innerHTML="";for(var d=this.Pu.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.qy&&("function"!==typeof f||f(a))){f=ua("li");f.className="goCXli";var g=ua("a");g.className="goCXa";g.href="#";g.qz=e.qy;g.addEventListener("click",function(c){this.qz(a);b.stopTool();
c.preventDefault();return!1},!1);g.textContent=e.text;f.appendChild(g);c.appendChild(f)}}ah.style.display="block";bh.style.display="block"};Xg.prototype.hideDefaultContextMenu=function(){if(null!==this.currentContextMenu&&this.currentContextMenu===Zg){ah.style.display="none";bh.style.display="none";var a=this.diagram;null!==a&&a.removeEventListener(bh,"click",this.Jv,!1);this.currentContextMenu=null}};
ma.Object.defineProperties(Xg.prototype,{currentContextMenu:{configurable:!0,get:function(){return this.l},set:function(a){!F||null===a||a instanceof Te||a instanceof bf||v("ContextMenuTool.currentContextMenu must be an Adornment or HTMLInfo.");this.l=a;this.Ou=a instanceof Te?a.adornedPart:null}},defaultTouchContextMenu:{configurable:!0,get:function(){!1===ch&&null===Zg&&gh&&Yg(this);return Zg},set:function(a){!F||null===a||a instanceof Te||a instanceof bf||v("ContextMenuTool.defaultTouchContextMenu must be an Adornment or HTMLInfo.");
null===a&&(ch=!0);Zg=a}},currentObject:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&x(a,N,Xg,"currentObject");this.w=a}},mouseDownPoint:{configurable:!0,get:function(){return this.Ox}}});var Zg=null,ch=!1,bh=null,ah=null;Xg.className="ContextMenuTool";Sa("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){this.eb("ContextMenu",a,this.mouseUpTools)});
function hh(){0<arguments.length&&za(hh);Oe.call(this);this.name="TextEditing";this.Kh=new ih;this.Pa=null;this.Oa=jh;this.gj=null;this.oa=kh;this.L=1;this.W=!0;this.w=null;this.l=new bf;this.Tu=null;lh(this,this.l)}la(hh,Oe);
function lh(a,b){if(gh){var c=ua("textarea");a.Tu=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.Wy(this.value);this.style.width=20+b.measuredBounds.width*this.rB+"px";this.rows=b.lineCount}},!1);c.addEventListener("keydown",function(b){if(null!==a.textBlock){var c=b.which;13===c?(!1===a.textBlock.isMultiline&&b.preventDefault(),a.acceptText(mh)):9===c?(a.acceptText(nh),b.preventDefault()):27===c&&(a.doCancel(),null!==a.diagram&&a.diagram.doFocus())}},!1);c.addEventListener("focus",
function(){if(null!==a.currentTextEditor&&a.state!==kh){var b=a.Tu;a.oa===oh&&(a.oa=ph);"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);c.addEventListener("blur",function(){if(null!==a.currentTextEditor&&a.state!==kh){var b=a.Tu;"function"===typeof b.focus&&b.focus();"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);b.valueFunction=function(){return c.value};b.mainElement=c;b.show=function(a,
b,f){if(a instanceof ih&&f instanceof hh)if(f.state===qh)c.style.border="3px solid red",c.focus();else{var d=a.ma(Mc),e=b.position,k=b.scale,l=a.Mf()*k;l<f.minimumEditorScale&&(l=f.minimumEditorScale);var m=a.naturalBounds.width*l+6,n=a.naturalBounds.height*l+2,p=(d.x-e.x)*k;d=(d.y-e.y)*k;c.value=a.text;b.div.style.font=a.font;c.style.position="absolute";c.style.zIndex="100";c.style.font="inherit";c.style.fontSize=100*l+"%";c.style.lineHeight="normal";c.style.width=m+"px";c.style.left=(p-m/2|0)-1+
"px";c.style.top=(d-n/2|0)-1+"px";c.style.textAlign=a.textAlign;c.style.margin="0";c.style.padding="1px";c.style.border="0";c.style.outline="none";c.style.whiteSpace="pre-wrap";c.style.overflow="hidden";c.rows=a.lineCount;c.rB=l;c.className="goTXarea";b.div.appendChild(c);c.focus();f.selectsTextOnActivate&&(c.select(),c.setSelectionRange(0,9999))}};b.hide=function(a){a.div.removeChild(c)}}}
hh.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||a.isReadOnly||rh&&rh!==this&&(rh.acceptText(sh),rh&&rh!==this)||!a.lastInput.left||this.isBeyondDragSize())return!1;var b=a.$b(a.lastInput.documentPoint);if(!(null!==b&&b instanceof ih&&b.editable&&b.part.canEdit()))return!1;b=b.part;return null===b||this.starting===jh&&!b.isSelected||this.starting===th&&2>a.lastInput.clickCount?!1:!0};hh.prototype.doStart=function(){rh=this;null!==this.textBlock&&this.doActivate()};
hh.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.$b(a.lastInput.documentPoint));if(null!==b&&b instanceof ih&&(this.textBlock=b,null!==b.part)){this.isActive=!0;this.oa=oh;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.Kh=this.textBlock.copy();var d=new L(this.textBlock.ma(Hc),this.textBlock.ma(Sc));a.Nw(d);c.show(b,a,this);this.currentTextEditor=c}}}};hh.prototype.doCancel=function(){this.stopTool()};
hh.prototype.doMouseUp=function(){this.canStart()&&this.doActivate()};hh.prototype.doMouseDown=function(){this.isActive&&this.acceptText(sh)};hh.prototype.acceptText=function(a){switch(a){case sh:if(this.oa===uh)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.oa===oh||this.oa===qh||this.oa===ph)this.oa=vh,wh(this);break;case xh:case mh:case nh:if(mh!==a||!0!==this.textBlock.isMultiline)if(this.oa===oh||this.oa===qh||this.oa===ph)this.oa=vh,wh(this)}};
function wh(a){var b=a.textBlock,c=a.diagram,d=a.currentTextEditor;if(null!==b&&null!==d){var e=b.text,f="";null!==d.valueFunction&&(f=d.valueFunction());if(a.isValidText(b,e,f))a.Ca(a.name),a.oa=uh,a.transactionResult=a.name,b.text=f,d=a.textBlock,null!==d.textEdited&&d.textEdited(d,e,f),null!==c&&c.U("TextEdited",b,e),a.Vg(),a.stopTool(),null!==c&&c.doFocus();else{a.oa=qh;var g=a.textBlock;null!==g.errorFunction&&g.errorFunction(a,e,f);d.show(b,c,a)}}}
hh.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.oa=kh,this.textBlock=null,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.isActive=!1)};hh.prototype.doStop=function(){rh=null};hh.prototype.isValidText=function(a,b,c){x(a,ih,hh,"isValidText:textblock");var d=this.textValidation;if(null!==d&&!d(a,b,c))return!1;d=a.textValidation;return null===d||d(a,b,c)?!0:!1};hh.prototype.Wy=function(a){var b=this.Kh;b.text=a;b.measure(this.textBlock.Oi,Infinity);return b};
ma.Object.defineProperties(hh.prototype,{textBlock:{configurable:!0,get:function(){return this.Pa},set:function(a){null!==a&&x(a,ih,hh,"textBlock");this.Pa=a}},currentTextEditor:{configurable:!0,get:function(){return this.w},set:function(a){this.w=a}},defaultTextEditor:{configurable:!0,get:function(){return this.l},set:function(a){!F||a instanceof bf||v("TextEditingTool.defaultTextEditor must be an HTMLInfo.");this.l=a}},starting:{configurable:!0,
get:function(){return this.Oa},set:function(a){hb(a,hh,hh,"starting");this.Oa=a}},textValidation:{configurable:!0,get:function(){return this.gj},set:function(a){null!==a&&A(a,"function",hh,"textValidation");this.gj=a}},minimumEditorScale:{configurable:!0,get:function(){return this.L},set:function(a){null!==a&&A(a,"number",hh,"minimumEditorScale");this.L=a}},selectsTextOnActivate:{configurable:!0,get:function(){return this.W},set:function(a){null!==a&&A(a,
"boolean",hh,"selectsTextOnActivate");this.W=a}},state:{configurable:!0,get:function(){return this.oa},set:function(a){this.oa!==a&&(hb(a,hh,hh,"starting"),this.oa=a)}}});hh.prototype.measureTemporaryTextBlock=hh.prototype.Wy;
var xh=new E(hh,"LostFocus",0),sh=new E(hh,"MouseDown",1),nh=new E(hh,"Tab",2),mh=new E(hh,"Enter",3),yh=new E(hh,"SingleClick",0),jh=new E(hh,"SingleClickSelected",1),th=new E(hh,"DoubleClick",2),kh=new E(hh,"StateNone",0),oh=new E(hh,"StateActive",1),ph=new E(hh,"StateEditing",2),vh=new E(hh,"StateValidating",3),qh=new E(hh,"StateInvalid",4),uh=new E(hh,"StateValidated",5),rh=null;hh.className="TextEditingTool";hh.LostFocus=xh;hh.MouseDown=sh;hh.Tab=nh;hh.Enter=mh;hh.SingleClick=yh;
hh.SingleClickSelected=jh;hh.DoubleClick=th;hh.StateNone=kh;hh.StateActive=oh;hh.StateEditing=ph;hh.StateValidating=vh;hh.StateInvalid=qh;hh.StateValidated=uh;Sa("textEditingTool",function(){return this.findTool("TextEditing")},function(a){this.eb("TextEditing",a,this.mouseUpTools)});
function zh(){Ah||(Bh(),Ah=!0);this.B=Pe;this.Gl=this.rf=this.xc=this.Es=this.oc=!1;this.by=!0;this.Hl=Ch;this.Fn=!1;this.Ji=this.nd=!0;this.jh=600;this.Bx=this.ay=!1;this.af=new I;this.Pd=new Dh;this.Pd.Xc=this;this.bl=new I;this.Gv=new I;this.Bt=new I}zh.prototype.ie=function(a){this.B=a};zh.prototype.canStart=function(){return!0};function Eh(a,b){Fh(a,b)&&(a.rf=!0)}function Fh(a,b){if(!a.nd||!a.canStart(b))return!1;a.af.add(b);a.defaultAnimation.isAnimating&&a.Tc();return a.xc=!0}
function Gh(a){if(a.nd&&a.xc){var b=a.Pd,c=a.B,d=a.af.contains("Model");d&&(a.Gl=!0,a.Hl===Ch?(b.isViewportUnconstrained=!0,b.rc.clear(),b.add(c,"position",c.position.copy().offset(0,-200),c.position),b.add(c,"opacity",0,1)):a.Hl===Hh&&b.rc.clear(),a.by=a.Hl===Uh&&c.ht.A(c.ra)?!0:!1,c.U("InitialAnimationStarting",a));d&&!a.Ji||0===b.rc.count?(a.af.clear(),a.xc=!1,a.rf=!1,b.rc.clear(),Vh(b,c),a.Gl=!1,c.P()):(a.af.clear(),c.Ne=!1,d=b.rc.get(c),c.autoScale!==Wh&&null!==d&&(delete d.start.scale,delete d.end.scale),
qa.requestAnimationFrame(function(){!1===a.xc||b.oc||(c.Te("temporaryPixelRatio")&&hf(c),Xh(c),a.xc=!1,a.rf=!1,b.start(),Yh(a),c.Ua(),Zh(b,0),Qf(c,!0),$h(a),c.U("AnimationStarting",a))}))}}function ai(a,b,c,d){b instanceof R&&(null!==b.fromNode||null!==b.toNode)||a.Pd.add(b,"position",c,d,!1)}t=zh.prototype;t.ou=function(a){return this.Pd.ou(a)};t.sw=function(a){return this.Pd.sw(a)};
function bi(a,b){function c(){0<e.Bt.count&&(d.addAll(e.Bt),e.Bt.clear(),e.oc=!0);if(!1!==e.oc&&0!==d.count){e.Gv.addAll(d);for(var a=e.Gv.iterator;a.next();){var b=a.value;if(!1!==b.oc){a:if(0<b.xm.count)var h=!0;else{for(h=b.rc.iterator;h.next();){var k=h.key;if(k instanceof N&&null!==k.diagram||k instanceof Q){h=!0;break a}}h=!1}h?ci(b,!1):b.Pl=!0}}e.Gv.clear();Yh(e);Qf(e.B);$h(e);qa.requestAnimationFrame(c)}}var d=a.bl,e=a;a.oc?a.Bt.add(b):(a.oc=!0,d.add(b),qa.requestAnimationFrame(function(){c()}))}
function di(a){for(a=a.bl.iterator;a.next();)a.value.Pl=!1}function Yh(a){if(!a.Es){var b=a.B;a.ay=b.skipsUndoManager;a.Bx=b.skipsModelSourceBindings;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;a.Es=!0}}function $h(a){var b=a.B;b.skipsUndoManager=a.ay;b.skipsModelSourceBindings=a.Bx;a.Es=!1}
t.Tc=function(a){var b=this.Pd;!0===this.xc&&(this.Gl=this.rf=this.xc=!1,this.af.clear(),0<b.rc.count&&this.B.Jb());if(this.oc){if(b.Fm(!0),b.rc.clear(),Vh(b,null),!0===a)for(a=this.bl.ta(),b=0;b<a.length;b++)a[b].Fm(!0)}else b.rc.clear(),Vh(b,this.B)};t.Fm=function(a){a===this.defaultAnimation&&this.defaultAnimation.rc.clear();this.bl.remove(a);0===this.bl.count&&(this.oc=!1,this.B.Jb());a===this.defaultAnimation&&(this.defaultAnimation.rc.clear(),this.B.U("AnimationFinished",this))};
t.vk=function(a,b){this.rf&&(this.af.contains("Expand Tree")||this.af.contains("Expand SubGraph"))&&this.Pd.vk(a,b)};t.tk=function(a,b){this.rf&&(this.af.contains("Collapse Tree")||this.af.contains("Collapse SubGraph"))&&(this.Pd.tk(a,b),ei(this.Pd,b,"position",b.position,b.position))};function fi(a,b,c){a.rf&&!b.A(c)&&(a.B.Aj||(b=c.copy()),ei(a.Pd,a.B,"position",b,c))}
function gi(a,b,c,d,e){null===a&&(a="rgba(0,0,0,0)");null===b&&(b="rgba(0,0,0,0)");hi(a);ii();var f=ji.l,g=ji.L,h=ji.w;a=ji.W;hi(b);ii();var k=ji.L,l=ji.w;b=ji.W;f=e(c,f,ji.l-f,d);g=e(c,g,k-g,d);h=e(c,h,l-h,d);c=e(c,a,b-a,d);return"hsla("+f+", "+g+"%, "+h+"%, "+c+")"}
function Bh(){var a=new Db;a.add("position:diagram",function(a,c,d,e,f,g){a.position=new J(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position",function(a,c,d,e,f,g){f<g?a.ur(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g),!1):a.position=new J(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("location",function(a,c,d,e,f,g){f<g?a.ur(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g),!0):a.location=new J(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position:placeholder",function(a,c,d,e,f,g){f<g?a.ur(e(f,c.x,d.x-c.x,
g),e(f,c.y,d.y-c.y,g),!1):a.position=new J(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position:node",function(a,c,d,e,f,g){var b=a.actualBounds,k=d.actualBounds;d=k.x+k.width/2-b.width/2;b=k.y+k.height/2-b.height/2;f<g?a.ur(e(f,c.x,d-c.x,g),e(f,c.y,b-c.y,g),!1):a.position=new J(e(f,c.x,d-c.x,g),e(f,c.y,b-c.y,g))});a.add("desiredSize",function(a,c,d,e,f,g){a.desiredSize=new L(e(f,c.width,d.width-c.width,g),e(f,c.height,d.height-c.height,g))});a.add("width",function(a,c,d,e,f,g){a.width=e(f,c,
d-c,g)});a.add("height",function(a,c,d,e,f,g){a.height=e(f,c,d-c,g)});a.add("fill",function(a,c,d,e,f,g){a.fill=gi(c,d,f,g,e)});a.add("stroke",function(a,c,d,e,f,g){a.stroke=gi(c,d,f,g,e)});a.add("strokeWidth",function(a,c,d,e,f,g){a.strokeWidth=e(f,c,d-c,g)});a.add("strokeDashOffset",function(a,c,d,e,f,g){a.strokeDashOffset=e(f,c,d-c,g)});a.add("background",function(a,c,d,e,f,g){a.background=gi(c,d,f,g,e)});a.add("areaBackground",function(a,c,d,e,f,g){a.areaBackground=gi(c,d,f,g,e)});a.add("opacity",
function(a,c,d,e,f,g){a.opacity=e(f,c,d-c,g)});a.add("scale",function(a,c,d,e,f,g){a.scale=e(f,c,d-c,g)});a.add("angle",function(a,c,d,e,f,g){a.angle=e(f,c,d-c,g)});ki=a}
ma.Object.defineProperties(zh.prototype,{animationReasons:{configurable:!0,get:function(){return this.af}},isEnabled:{configurable:!0,get:function(){return this.nd},set:function(a){A(a,"boolean",zh,"isEnabled");this.nd=a}},duration:{configurable:!0,get:function(){return this.jh},set:function(a){A(a,"number",zh,"duration");1>a&&ya(a,">= 1",zh,"duration");this.jh=a}},isAnimating:{configurable:!0,get:function(){return this.oc}},isTicking:{configurable:!0,
enumerable:!0,get:function(){return this.Es}},isInitial:{configurable:!0,get:function(){return this.Ji},set:function(a){A(a,"boolean",zh,"isInitial");this.Ji=a}},defaultAnimation:{configurable:!0,get:function(){return this.Pd}},activeAnimations:{configurable:!0,get:function(){return this.bl}},initialAnimationStyle:{configurable:!0,get:function(){return this.Hl},set:function(a){F&&hb(a,zh,zh,"initialAnimationStyle");this.Hl=a}}});
zh.prototype.stopAnimation=zh.prototype.Tc;var ki=null,Ah=!1,Ch=new E(zh,"Default",1),Uh=new E(zh,"AnimateLocations",2),Hh=new E(zh,"None",3);zh.className="AnimationManager";zh.defineAnimationEffect=function(a,b){Ah||(Bh(),Ah=!0);ki.add(a,b)};zh.Default=Ch;zh.AnimateLocations=Uh;zh.None=Hh;
function Dh(){this.Kv=this.$x=this.Xc=this.B=null;this.Pl=this.oc=this.l=!1;this.mo=this.Ed=0;this.Yr=this.Wu=li;this.Ol=this.Op=!1;this.Av=1;this.yv=0;this.wd=this.jh=NaN;this.Fx=0;this.no=null;this.w=Ob;this.rc=new Db;this.uv=new Db;this.xm=new I;this.vv=new I;this.Cx=mi}Dh.prototype.suspend=function(){this.Pl=!0};Dh.prototype.advanceTo=function(a,b){b&&(this.Pl=!1);this.Op&&a>=this.wd&&(this.Ol=!0,a-=this.wd);this.Fx=a;ci(this,!0);Yh(this.Xc);Qf(this.B);$h(this.Xc);this.B.We()};
function Vh(a,b){a.uv.clear();a.Ol=!1;a.yv=0;a.wd=NaN;0<a.xm.count&&a.xm.clear();0<a.vv.count&&a.vv.clear();if(null!==b)for(a=b.links;a.next();)a.value.Cg=null}t=Dh.prototype;
t.start=function(){if(0!==this.rc.count&&!this.oc){for(var a=this.B,b=this.rc.iterator;b.next();){var c=b.value.end,d=b.key;if(c["position:placeholder"]){var e=d.findVisibleNode();if(e instanceof Hf&&null!==e.placeholder){var f=e.placeholder;e=f.ma(Hc);f=f.padding;e.x+=f.left;e.y+=f.top;c["position:placeholder"]=e}}null===a&&(d instanceof Q?a=d:d instanceof N&&(a=d.diagram))}null!==a&&(this.B=a,b=this.Xc=a.animationManager,!1!==b.isEnabled&&(this.wd=isNaN(this.jh)?b.duration:this.jh,this.Yr=this.Wu,
b.Gl&&b.Hl===Ch&&this===b.defaultAnimation&&(this.Yr=ni,this.wd=isNaN(this.jh)?600===b.duration?900:b.duration:this.jh),this.Cx=a.scrollMode,this.isViewportUnconstrained&&(a.dj=oi),Yh(b),this.xm.each(function(b){b.data=null;a.add(b)}),$h(b),this.oc=!0,this.Ed=+new Date,this.mo=this.Ed+this.wd,bi(b,this)))}};
t.Ez=function(a,b){a.bc()&&(F&&(void 0===b&&v("addTemporaryPart: Required Diagram argument missing"),a.diagram===b&&v("addTemporaryPart: Part already in Diagram, did you mean to pass in a copy?"),null!==this.B&&this.B!==b&&v("addTemporaryPart: A different Diagram is already associated with this Animation: "+this.B.toString())),this.xm.add(a),this.B=b)};
t.add=function(a,b,c,d,e){"position"===b&&c.A(d)||(null===this.B&&(a instanceof Q?this.B=a:a instanceof N&&null!==a.diagram&&(this.B=a.diagram)),a instanceof S&&!a.isAnimated||ei(this,a,b,c,d,e))};
function ei(a,b,c,d,e,f){var g=a.rc;b instanceof Q&&"position"===c&&(c="position:diagram");if(g.contains(b)){var h=g.K(b);var k=h.start;var l=h.end;void 0===k[c]&&(k[c]=pi(d));l[c]=pi(e)}else k={},l={},k[c]=pi(d),l[c]=pi(e),h=k.position,b instanceof N&&h instanceof J&&!h.o()&&b.diagram.animationManager.af.contains("Expand SubGraph")&&h.assign(l.position),h=new qi(k,l,f),g.add(b,h);g=k[c];g instanceof J&&!g.o()&&g.assign(a.w);f&&0===c.indexOf("position:")&&b instanceof S?h.dw.location=pi(b.location):
f&&(h.dw[c]=pi(d))}function pi(a){return a instanceof J?a.copy():a instanceof Hb?a.copy():a}t.ou=function(a){if(!this.oc)return!1;a=this.rc.K(a);return null!==a&&a.Dw};t.sw=function(a){if(!this.oc)return!1;a=this.rc.K(a);return null!==a&&(a.start.position||a.start.location)};
function ci(a,b){if(!a.Pl||b){var c=a.Xc;if(!1!==a.oc){var d=+new Date,e=d>a.mo?a.wd:d-a.Ed;b&&(e=a.Fx,e<a.wd?(a.Ed=+new Date-e,a.mo=a.Ed+a.wd):e=a.wd);Yh(c);Zh(a,e);Qf(a.B,!0);$h(c);d>a.mo&&(a.Op&&!a.Ol?(a.Ed=+new Date,a.mo=a.Ed+a.wd,a.Ol=!0):a.Fm(!1))}}}
function Zh(a,b){for(var c=a.wd,d=a.rc.iterator,e=a.Ol;d.next();){var f=d.key;if(!(f instanceof N&&null===f.diagram)){var g=d.value,h=e?g.end:g.start;g=e?g.start:g.end;var k=ki,l;for(l in g)"position"===l&&(g["position:placeholder"]||g["position:node"])||null===k.get(l)||k.get(l)(f,h[l],g[l],a.Yr,b,c,a)}}}t.stop=function(){this.oc&&this.Fm(!0)};
t.Fm=function(a){null!==this.Kv&&this.Kv.Vp.remove(this.$x);if(this.oc){var b=this.B,c=this.Xc;this.Pl=this.oc=c.Gl=!1;Yh(c);for(var d=this.rc,e=this.xm.iterator;e.next();)b.remove(e.value);for(e=this.vv.iterator;e.next();)e.value.v();e=this.Op;d=d.iterator;for(var f=ki;d.next();){var g=d.key,h=d.value,k=e?h.end:h.start,l=e?h.start:h.end,m=h.dw,n;for(n in l)if(null!==f.get(n)){var p=n;!h.Wv||"position:node"!==p&&"position:placeholder"!==p||(p="position");f.get(p)(g,k[n],void 0!==m[n]?m[n]:h.Wv?k[n]:
l[n],this.Yr,this.wd,this.wd,this)}h.Wv&&void 0!==m.location&&g instanceof S&&(g.location=m.location);h.Dw&&g instanceof S&&g.Ub(!1)}if(c.defaultAnimation===this)for(n=this.B.links;n.next();)e=n.value,null===e.Cg?(d=e.path,null!==d&&(e.kd=!1,e.v(),d.v())):(e.points=e.Cg,e.Cg=null);b.ju.clear();wf(b,!1);b.Ua();b.P();Qf(b,!0);this.isViewportUnconstrained&&(b.scrollMode=this.Cx);$h(c);this.yv++;!a&&this.Av>this.yv?(this.Ol=!1,this.start()):(this.no&&this.no(this),Vh(this,null),c.Fm(this),b.Jb())}};
t.vk=function(a,b){var c=b.actualBounds,d=null;b instanceof Hf&&(d=b.placeholder);null!==d?(c=d.ma(Hc),d=d.padding,c.x+=d.left,c.y+=d.top,this.add(a,"position",c,a.position,!1)):this.add(a,"position",new J(c.x+c.width/2,c.y+c.height/2),a.position,!1);this.add(a,"scale",.01,a.scale,!1);if(a instanceof Hf)for(a=a.memberParts;a.next();)d=a.value,d instanceof U&&this.vk(d,b)};
t.tk=function(a,b){if(a.isVisible()){var c=null;b instanceof Hf&&(c=b.placeholder);null!==c?this.add(a,"position:placeholder",a.position,c,!0):this.add(a,"position:node",a.position,b,!0);this.add(a,"scale",a.scale,.01,!0);c=this.rc;c.contains(a)&&(c.K(a).Dw=!0);if(a instanceof Hf)for(a=a.memberParts;a.next();)c=a.value,c instanceof U&&this.tk(c,b)}};t.EA=function(a){var b=this.uv.get(a);null===b&&(b={},this.uv.add(a,b));return b};
ma.Object.defineProperties(Dh.prototype,{duration:{configurable:!0,get:function(){return this.jh},set:function(a){A(a,"number",Dh,"duration");1>a&&ya(a,">= 1",Dh,"duration");this.jh=a}},reversible:{configurable:!0,get:function(){return this.Op},set:function(a){this.Op=a}},runCount:{configurable:!0,get:function(){return this.Av},set:function(a){0<a?this.Av=a:v("Animation.runCount value must be a positive integer.")}},finished:{configurable:!0,
get:function(){return this.no},set:function(a){this.no!==a&&(null!==a&&A(a,"function",Q,"click"),this.no=a)}},easing:{configurable:!0,get:function(){return this.Wu},set:function(a){this.Wu=a}},isViewportUnconstrained:{configurable:!0,get:function(){return this.l},set:function(a){this.l=a}},isAnimating:{configurable:!0,get:function(){return this.oc}}});Dh.prototype.getTemporaryState=Dh.prototype.EA;Dh.prototype.stop=Dh.prototype.stop;Dh.prototype.add=Dh.prototype.add;
Dh.prototype.addTemporaryPart=Dh.prototype.Ez;function li(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}function ni(a,b,c,d){return a===d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b}Dh.className="Animation";Dh.EaseLinear=function(a,b,c,d){return c*a/d+b};Dh.EaseInOutQuad=li;Dh.EaseInQuad=function(a,b,c,d){return c*(a/=d)*a+b};Dh.EaseOutQuad=function(a,b,c,d){return-c*(a/=d)*(a-2)+b};Dh.EaseInExpo=function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b};Dh.EaseOutExpo=ni;
function qi(a,b,c){this.start=a;this.end=b;this.dw={};this.Wv=c;this.Dw=!1}qi.className="AnimationState";function ri(a,b,c){this.pd=null;this.tf=a;this.oq=c||si;this.gl=null;void 0!==b&&(this.gl=b,void 0===c&&(this.oq=ti))}ri.prototype.copy=function(){var a=new ri(this.tf);a.oq=this.oq;var b=this.gl;if(null!==b){var c={};void 0!==b.duration&&(c.Ay=b.duration);void 0!==b.finished&&(c.Ay=b.finished);void 0!==b.easing&&(c.Ay=b.easing);a.gl=c}return a};
function ui(a,b){a=a.gl;null!==a&&(a.duration&&(b.duration=a.duration),a.finished&&(b.finished=a.finished),a.easing&&(b.easing=a.easing))}
ma.Object.defineProperties(ri.prototype,{propertyName:{configurable:!0,get:function(){return this.tf},set:function(a){this.tf=a}},animationSettings:{configurable:!0,get:function(){return this.gl},set:function(a){this.gl=a}},startCondition:{configurable:!0,get:function(){return this.oq},set:function(a){F&&hb(a,ri,ri,"startCondition");this.oq=a}}});var si=new E(ri,"Default",1),ti=new E(ri,"Immediate",2),vi=new E(ri,"Bundled",3);ri.className="AnimationTrigger";
ri.Default=si;ri.Immediate=ti;ri.Bundled=vi;function wi(){0<arguments.length&&za(wi);fb(this);this.B=null;this.Ia=new H;this.Wa="";this.yb=1;this.w=!1;this.Zi=this.L=this.ui=this.ti=this.si=this.ri=this.oi=this.pi=this.ni=this.wi=this.mi=this.vi=this.li=this.ki=!0;this.l=!1;this.Bp=[]}t=wi.prototype;t.clear=function(){this.Ia.clear();this.Bp.length=0};t.ie=function(a){this.B=a};
t.toString=function(a){void 0===a&&(a=0);var b='Layer "'+this.name+'"';if(0>=a)return b;for(var c=0,d=0,e=0,f=0,g=0,h=this.Ia.iterator;h.next();){var k=h.value;k instanceof Hf?e++:k instanceof U?d++:k instanceof R?f++:k instanceof Te?g++:c++}h="";0<c&&(h+=c+" Parts ");0<d&&(h+=d+" Nodes ");0<e&&(h+=e+" Groups ");0<f&&(h+=f+" Links ");0<g&&(h+=g+" Adornments ");if(1<a)for(a=this.Ia.iterator;a.next();)c=a.value,h+="\n    "+c.toString(),d=c.data,null!==d&&pb(d)&&(h+=" #"+pb(d)),c instanceof U?h+=" "+
Qa(d):c instanceof R&&(h+=" "+Qa(c.fromNode)+" "+Qa(c.toNode));return b+" "+this.Ia.count+": "+h};
t.$b=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.Zi)return null;F&&!a.o()&&v("findObjectAt: Point must have a real value, not: "+a.toString());var d=!1;null!==this.diagram&&this.diagram.viewportBounds.fa(a)&&(d=!0);for(var e=J.alloc(),f=this.Ia.j,g=f.length;g--;){var h=f[g];if((!0!==d||!1!==Jg(h))&&h.isVisible()&&(e.assign(a),Jb(e,h.Gd),h=h.$b(e,b,c),null!==h&&(null!==b&&(h=b(h)),null!==h&&(null===c||c(h)))))return J.free(e),h}J.free(e);return null};
t.sj=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof H||d instanceof I||(d=new I);if(!1===this.Zi)return d;F&&!a.o()&&v("findObjectsAt: Point must have a real value, not: "+a.toString());var e=!1;null!==this.diagram&&this.diagram.viewportBounds.fa(a)&&(e=!0);for(var f=J.alloc(),g=this.Ia.j,h=g.length;h--;){var k=g[h];if((!0!==e||!1!==Jg(k))&&k.isVisible()){f.assign(a);Jb(f,k.Gd);var l=k;k.sj(f,b,c,d)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||d.add(l))}}J.free(f);return d};
t.Lf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof H||e instanceof I||(e=new I);if(!1===this.Zi)return e;F&&!a.o()&&v("findObjectsIn: Rect must have a real value, not: "+a.toString());var f=!1;null!==this.diagram&&this.diagram.viewportBounds.Qe(a)&&(f=!0);for(var g=this.Ia.j,h=g.length;h--;){var k=g[h];if((!0!==f||!1!==Jg(k))&&k.isVisible()){var l=k;k.Lf(a,b,c,d,e)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||e.add(l))}}return e};
t.iw=function(a,b,c,d,e,f,g){if(!1===this.Zi)return e;for(var h=this.Ia.j,k=h.length;k--;){var l=h[k];if((!0!==g||!1!==Jg(l))&&f(l)&&l.isVisible()){var m=l;l.Lf(a,b,c,d,e)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||e.add(m))}}return e};
t.Qg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof H||e instanceof I)f=e;e=!0}f instanceof H||f instanceof I||(f=new I);if(!1===this.Zi)return f;F&&!a.o()&&v("findObjectsNear: Point must have a real value, not: "+a.toString());var g=!1;null!==this.diagram&&this.diagram.viewportBounds.fa(a)&&(g=!0);for(var h=J.alloc(),k=J.alloc(),l=this.Ia.j,m=l.length;m--;){var n=l[m];if((!0!==g||!1!==Jg(n))&&n.isVisible()){h.assign(a);Jb(h,n.Gd);
k.h(a.x+b,a.y);Jb(k,n.Gd);var p=n;n.Qg(h,k,c,d,e,f)&&(null!==c&&(p=c(p)),null===p||null!==d&&!d(p)||f.add(p))}}J.free(h);J.free(k);return f};
t.Md=function(a,b){if(this.visible){var c=this.Ia.j,d=c.length;if(0!==d){a=La();for(var e=La(),f=0;f<d;f++){var g=c[f];g.Mx=f;if(g instanceof R){if(!1===g.kd)continue}else if(g instanceof Te&&null!==g.adornedPart)continue;nc(g.actualBounds,b)?(g.Md(!0),a.push(g)):(g.Md(!1),null!==g.adornments&&0<g.adornments.count&&e.push(g))}for(b=0;b<a.length;b++)for(c=a[b],xi(c),c=c.adornments;c.next();)d=c.value,d.measure(Infinity,Infinity),d.arrange(),d.Md(!0);for(b=0;b<e.length;b++)xi(e[b]);Oa(a);Oa(e)}}};
function yi(a,b){var c=1;1!==a.yb&&(c=b.globalAlpha,b.globalAlpha=c*a.yb);return c}t.hc=function(a,b,c){if(this.visible&&0!==this.yb&&(void 0===c&&(c=!0),c||!this.isTemporary)){c=this.Ia.j;var d=c.length;if(0!==d){var e=yi(this,a),f=this.Bp;f.length=0;for(var g=b.scale,h=L.alloc(),k=0;k<d;k++)this.oj(a,c[k],b,f,g,h,!0);L.free(h);a.globalAlpha=e}}};
t.oj=function(a,b,c,d,e,f,g){if(!g||Jg(b)){if(null!==d&&b instanceof R&&(b.isOrthogonal&&d.push(b),!1===b.kd))return;g=b.actualBounds;d=!1;var h=b.containingGroup;if(null!==h&&h.isClipping&&h.type!==V.Spot&&b.isVisible()){d=h.resizeObject;d instanceof V&&(d=d.ub());d.Km(f);d instanceof Yf&&f.Oc(-d.strokeWidth,-d.strokeWidth);if(!f.Rc(g))return;d=!f.Qe(g)}d&&(a.save(),a.beginPath(),a.rect(f.x,f.y,f.width,f.height),a.clip());g.width*e>c.gp||g.height*e>c.gp?b.hc(a,c):(e=b.actualBounds,f=b.naturalBounds,
0===e.width||0===e.height||isNaN(e.x)||isNaN(e.y)||!b.isVisible()||(c=b.transform,null!==b.areaBackground&&(zi(b,a,b.areaBackground,!0,!0,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null===b.areaBackground&&null===b.background&&(zi(b,a,"rgba(0,0,0,0.3)",!0,!1,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null!==b.background&&(a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),zi(b,a,b.background,!0,!1,f,e),a.fillRect(0,0,f.width/2,f.height/2),c.gu()||(b=1/(c.m11*c.m22-c.m12*c.m21),a.transform(c.m22*b,-c.m12*
b,-c.m21*b,c.m11*b,b*(c.m21*c.dy-c.m22*c.dx),b*(c.m12*c.dx-c.m11*c.dy))))));d&&(a.restore(),a.zc(!0))}};t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.hb(He,a,this,b,c,d,e)};t.yj=function(a,b,c){var d=this.Ia;b.Pi=this;if(a>=d.count)a=d.count;else if(d.O(a)===b)return-1;d.Ab(a,b);b.Xq(c);d=this.diagram;null!==d&&(c?d.P():d.yj(b));Ai(this,a,b);return a};
t.Qc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.Qc(a,b,c);var d=this.Ia;if(0>a||a>=d.length){if(a=d.indexOf(b),0>a)return-1}else if(d.O(a)!==b&&(a=d.indexOf(b),0>a))return-1;b.Yq(c);d.ib(a);d=this.diagram;null!==d&&(c?d.P():d.Qc(b));b.Pi=null;return a};
function Ai(a,b,c){b=Bi(a,b,c);if(c instanceof Hf&&null!==c&&isNaN(c.zOrder)){if(0!==c.memberParts.count){for(var d=-1,e=a.Ia.j,f=e.length,g=0;g<f;g++){var h=e[g];if(h===c&&(b=g,0<=d))break;if(0>d&&h.containingGroup===c&&(d=g,0<=b))break}!(0>d)&&d<b&&(e=a.Ia,e.ib(b),e.Ab(d,c))}c=c.containingGroup;null!==c&&Ai(a,-1,c)}}
function Bi(a,b,c){var d=c.zOrder;if(isNaN(d))return b;a=a.Ia;var e=a.count;if(1>=e)return b;0>b&&(b=a.indexOf(c));if(0>b)return-1;for(var f=b-1,g=NaN;0<=f;){g=a.O(f).zOrder;if(!isNaN(g))break;f--}for(var h=b+1,k=NaN;h<e;){k=a.O(h).zOrder;if(!isNaN(k))break;h++}if(!isNaN(g)&&g>d)for(;;){if(-1===f||g<=d){f++;if(f===b)break;a.ib(b);a.Ab(f,c);return f}for(g=NaN;0<=--f&&(g=a.O(f).zOrder,isNaN(g)););}else if(!isNaN(k)&&k<d)for(;;){if(h===e||k>=d){h--;if(h===b)break;a.ib(b);a.Ab(h,c);return h}for(k=NaN;++h<
e&&(k=a.O(h).zOrder,isNaN(k)););}return b}
ma.Object.defineProperties(wi.prototype,{parts:{configurable:!0,get:function(){return this.Ia.iterator}},partsBackwards:{configurable:!0,get:function(){return this.Ia.iteratorBackwards}},diagram:{configurable:!0,get:function(){return this.B}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){A(a,"string",wi,"name");var b=this.Wa;if(b!==a){var c=this.diagram;if(null!==c)for(""===b&&v("Cannot rename default Layer to: "+a),c=
c.layers;c.next();)c.value.name===a&&v("Layer.name is already present in this diagram: "+a);this.Wa=a;this.g("name",b,a);for(a=this.Ia.iterator;a.next();)a.value.layerName=this.Wa}}},opacity:{configurable:!0,get:function(){return this.yb},set:function(a){var b=this.yb;b!==a&&(A(a,"number",wi,"opacity"),(0>a||1<a)&&ya(a,"0 <= value <= 1",wi,"opacity"),this.yb=a,this.g("opacity",b,a),a=this.diagram,null!==a&&a.P())}},isTemporary:{configurable:!0,get:function(){return this.w},
set:function(a){var b=this.w;b!==a&&(A(a,"boolean",wi,"isTemporary"),this.w=a,this.g("isTemporary",b,a))}},visible:{configurable:!0,get:function(){return this.L},set:function(a){var b=this.L;if(b!==a){A(a,"boolean",wi,"visible");this.L=a;this.g("visible",b,a);for(b=this.Ia.iterator;b.next();)b.value.Ub(a);a=this.diagram;null!==a&&a.P()}}},pickable:{configurable:!0,get:function(){return this.Zi},set:function(a){var b=this.Zi;b!==a&&(A(a,"boolean",wi,"pickable"),this.Zi=
a,this.g("pickable",b,a))}},isBoundsIncluded:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a,null!==this.diagram&&this.diagram.Ua())}},allowCopy:{configurable:!0,get:function(){return this.ki},set:function(a){var b=this.ki;b!==a&&(A(a,"boolean",wi,"allowCopy"),this.ki=a,this.g("allowCopy",b,a))}},allowDelete:{configurable:!0,get:function(){return this.li},set:function(a){var b=this.li;b!==a&&(A(a,"boolean",wi,"allowDelete"),
this.li=a,this.g("allowDelete",b,a))}},allowTextEdit:{configurable:!0,get:function(){return this.vi},set:function(a){var b=this.vi;b!==a&&(A(a,"boolean",wi,"allowTextEdit"),this.vi=a,this.g("allowTextEdit",b,a))}},allowGroup:{configurable:!0,get:function(){return this.mi},set:function(a){var b=this.mi;b!==a&&(A(a,"boolean",wi,"allowGroup"),this.mi=a,this.g("allowGroup",b,a))}},allowUngroup:{configurable:!0,get:function(){return this.wi},set:function(a){var b=
this.wi;b!==a&&(A(a,"boolean",wi,"allowUngroup"),this.wi=a,this.g("allowUngroup",b,a))}},allowLink:{configurable:!0,get:function(){return this.ni},set:function(a){var b=this.ni;b!==a&&(A(a,"boolean",wi,"allowLink"),this.ni=a,this.g("allowLink",b,a))}},allowRelink:{configurable:!0,get:function(){return this.pi},set:function(a){var b=this.pi;b!==a&&(A(a,"boolean",wi,"allowRelink"),this.pi=a,this.g("allowRelink",b,a))}},allowMove:{configurable:!0,get:function(){return this.oi},
set:function(a){var b=this.oi;b!==a&&(A(a,"boolean",wi,"allowMove"),this.oi=a,this.g("allowMove",b,a))}},allowReshape:{configurable:!0,get:function(){return this.ri},set:function(a){var b=this.ri;b!==a&&(A(a,"boolean",wi,"allowReshape"),this.ri=a,this.g("allowReshape",b,a))}},allowResize:{configurable:!0,get:function(){return this.si},set:function(a){var b=this.si;b!==a&&(A(a,"boolean",wi,"allowResize"),this.si=a,this.g("allowResize",b,a))}},allowRotate:{configurable:!0,
enumerable:!0,get:function(){return this.ti},set:function(a){var b=this.ti;b!==a&&(A(a,"boolean",wi,"allowRotate"),this.ti=a,this.g("allowRotate",b,a))}},allowSelect:{configurable:!0,get:function(){return this.ui},set:function(a){var b=this.ui;b!==a&&(A(a,"boolean",wi,"allowSelect"),this.ui=a,this.g("allowSelect",b,a))}}});wi.prototype.findObjectsNear=wi.prototype.Qg;wi.prototype.findObjectsIn=wi.prototype.Lf;wi.prototype.findObjectsAt=wi.prototype.sj;wi.prototype.findObjectAt=wi.prototype.$b;
wi.className="Layer";
function Q(a){1<arguments.length&&v("Diagram constructor can only take one optional argument, the DIV HTML element or its id.");Ci||(Di(),Ci=!0);fb(this);Pe=this;Xa=[];this.Xb=!0;this.Xc=new zh;this.Xc.ie(this);this.sb=17;this.Nl=this.Cv=!1;this.gt="default";this.Ja=null;if(gh){var b=this,c=function(){b.removeEventListener(qa.document,"DOMContentLoaded",c,!1);b.setRTL()};null!==qa.document.body?this.setRTL():b.addEventListener(qa.document,"DOMContentLoaded",c,!1)}this.Qa=new H;this.Da=this.Ea=0;this.em=
this.Aa=null;this.Wx=new Db;this.uf=this.Mb=null;this.Kw();this.Wj=null;this.Jw();this.yb=1;this.ra=(new J(NaN,NaN)).freeze();this.ht=new J(NaN,NaN);this.bo=this.Fa=1;this.us=(new J(NaN,NaN)).freeze();this.vs=NaN;this.Ms=1E-4;this.Ks=100;this.tb=new Ib;this.Kt=(new J(NaN,NaN)).freeze();this.ps=(new L(NaN,NaN,NaN,NaN)).freeze();this.cj=(new lc(0,0,0,0)).freeze();this.dj=mi;this.pt=!1;this.it=this.ct=null;this.$g=Wh;this.Mj=ld;this.jg=Wh;this.Do=ld;this.ws=this.ts=Hc;this.Jc=!0;this.Ll=!1;this.xd=new I;
this.hh=new Db;this.wl=!0;this.Cn=250;this.Kj=-1;this.En=(new lc(16,16,16,16)).freeze();this.Qj=this.Ne=!1;this.Tj=!0;this.gg=new we;this.gg.diagram=this;this.be=new we;this.be.diagram=this;this.sh=new we;this.sh.diagram=this;this.De=this.Zf=null;this.rk=!1;this.fs=this.gs=null;this.yn=qa.PointerEvent&&($a||bb||cb)&&qa.navigator&&!1!==qa.navigator.msPointerEnabled;Ei(this);this.Oh=new I;this.Fs=!0;this.Et=Fi;this.fv=!1;this.Gt=$f;this.Pa=null;Gi.add("Model",Hi);this.Zr=this.cs=this.Ct=null;this.ao=
this.Xr="auto";this.sg=this.Ps=this.ug=this.vg=this.xg=this.ag=this.eg=this.$f=null;this.ss=!1;this.bg=this.Ig=this.wg=this.tg=null;this.Qs=!1;this.at={};this.kk=[null,null];this.Rr=null;this.ds=this.tt=this.Ev=this.Gg=!1;this.mv=!0;this.Ii=this.pc=!1;this.gc=null;var d=this;this.Hc=function(a){var b=d.partManager;if(a.model===b.diagram.model&&b.diagram.ba){b.diagram.ba=!1;try{var c=a.change;""===a.modelChange&&c===He&&b.updateDataBindings(a.object,a.propertyName)}finally{b.diagram.ba=!0}}};this.Wc=
function(a){d.partManager.doModelChanged(a)};this.Mv=!0;this.Vd=-2;this.$i=new Db;this.$s=new H;this.lg=!1;this.li=this.ki=this.Er=this.nd=!0;this.Fr=!1;this.Lr=this.Jr=this.ui=this.ti=this.si=this.ri=this.oi=this.pi=this.ni=this.Ir=this.wi=this.mi=this.vi=this.Gr=!0;this.kg=this.iv=!1;this.Kr=this.Hr=this.Dl=this.Cl=!0;this.ot=this.kt=16;this.jt=this.Xp=!1;this.Yp=this.mt=null;this.lt=this.nt=0;this.mb=(new lc(5)).freeze();this.Dv=(new I).freeze();this.Ls=999999999;this.cv=(new I).freeze();this.Hi=
this.Gi=this.Fi=!0;this.jf=this.ve=!1;this.qc=null;this.Zg=!0;this.we=!1;this.Nx=new I;this.dv=new I;this.Mc=null;this.bm=1;this.Fv=0;this.ce={scale:1,position:new J,bounds:new L,uw:!1};this.ey=(new L(NaN,NaN,NaN,NaN)).freeze();this.zm=(new Hb(NaN,NaN)).freeze();this.co=(new L(NaN,NaN,NaN,NaN)).freeze();this.Gs=!1;this.Uo=this.Bo=this.tp=this.Ru=this.Qu=this.Su=this.ng=this.qh=this.qf=this.ks=null;Ii(this);this.Ob=null;this.Ao=!1;this.Nj=null;this.partManager=new Hi;this.toolManager=new Ta;this.toolManager.initializeStandardTools();
this.currentTool=this.defaultTool=this.toolManager;this.js=null;this.pl=new ef;this.Vs=this.Us=null;this.qq=!1;this.commandHandler=Ji();this.model=Ki();this.Gg=!0;Li(this);this.layout=new Mi;this.Gg=!1;this.Gx=this.Vu=null;this.Yb=1;this.Jh=null;this.gp=1;this.mp=0;this.tv=[0,0,0,0,0];this.np=0;this.yd=1;this.ak=0;this.Po=new J;this.Dt=500;this.Dn=new J;this.xe=!1;this.Um=this.Vm=this.Tm=this.Sm=this.Pk=this.Rk=this.Qk=this.Nk=this.Ok=this.kx=this.Zw=this.$w=this.ax=this.Dh=this.gm=this.Ch=this.fm=
null;this.mr=function(){};this.preventDefault=null;this.Fo=!1;this.Ei=new Ni;this.rq=!1;void 0!==a&&Oi(this,a);this.oo=null;this.po=Vb;this.Xb=!1}Q.prototype.clear=function(){this.animationManager.Tc();this.model.clear();Pi=null;Qi="";Ri(this,!1);this.Ua();this.Ya();this.P()};
function Ri(a,b){a.animationManager.Tc(!0);a.Dv=(new I).freeze();a.cv=(new I).freeze();var c=a.skipsUndoManager;null!==a.model&&(a.skipsUndoManager=!0);var d=null;null!==a.Ob&&(d=a.Ob.part,null!==d&&a.remove(d));var e=[],f=a.Qa.length;if(b){for(b=0;b<f;b++)for(var g=a.Qa.j[b].parts;g.next();){var h=g.value;h!==d&&null===h.data&&e.push(h)}for(b=0;b<e.length;b++)a.remove(e[b])}for(b=0;b<f;b++)a.Qa.j[b].clear();a.partManager.clear();a.xd.clear();a.hh.clear();a.Oh.clear();a.Nj=null;Na=[];null!==d&&(a.add(d),
a.partManager.parts.remove(d));null!==a.model&&(a.skipsUndoManager=c);return e}function Ji(){return null}
Q.prototype.reset=function(){this.clear();this.Xb=!0;this.Xc=new zh;this.Xc.ie(this);this.sb=17;this.Nl=this.Cv=!1;this.gt="default";this.Qa=new H;this.Wx=new Db;this.uf=null;this.Kw();this.Wj=null;this.Jw();this.yb=1;this.ra=(new J(NaN,NaN)).freeze();this.ht=new J(NaN,NaN);this.bo=this.Fa=1;this.us=(new J(NaN,NaN)).freeze();this.vs=NaN;this.Ms=1E-4;this.Ks=100;this.tb=new Ib;this.Kt=(new J(NaN,NaN)).freeze();this.ps=(new L(NaN,NaN,NaN,NaN)).freeze();this.cj=(new lc(0,0,0,0)).freeze();this.dj=mi;
this.pt=!1;this.it=this.ct=null;this.$g=Wh;this.Mj=ld;this.jg=Wh;this.Do=ld;this.ws=this.ts=Hc;this.Jc=!0;this.Ll=!1;this.xd=new I;this.hh=new Db;this.wl=!0;this.Cn=250;this.Kj=-1;this.En=(new lc(16,16,16,16)).freeze();this.Qj=this.Ne=!1;this.Tj=!0;this.gg=new we;this.gg.diagram=this;this.be=new we;this.be.diagram=this;this.sh=new we;this.sh.diagram=this;this.De=this.Zf=null;this.rk=!1;this.fs=this.gs=null;this.yn=qa.PointerEvent&&($a||bb||cb)&&qa.navigator&&!1!==qa.navigator.msPointerEnabled;Ei(this);
this.Oh=new I;this.Fs=!0;this.Et=Fi;this.fv=!1;this.Gt=$f;this.Zr=this.cs=this.Ct=null;this.ao=this.Xr="auto";this.sg=this.Ps=this.ug=this.vg=this.xg=this.ag=this.eg=this.$f=null;this.ss=!1;this.bg=this.Ig=this.wg=this.tg=null;this.Qs=!1;this.at={};this.kk=[null,null];this.Rr=null;this.ds=this.tt=this.Ev=this.Gg=!1;this.mv=!0;this.Ii=this.pc=!1;this.Mv=!0;this.Vd=-2;this.$i=new Db;this.$s=new H;this.lg=!1;this.li=this.ki=this.Er=this.nd=!0;this.Fr=!1;this.Lr=this.Jr=this.ui=this.ti=this.si=this.ri=
this.oi=this.pi=this.ni=this.Ir=this.wi=this.mi=this.vi=this.Gr=!0;this.kg=this.iv=!1;this.Kr=this.Hr=this.Dl=this.Cl=!0;this.ot=this.kt=16;this.jt=this.Xp=!1;this.lt=this.nt=0;this.mb=(new lc(5)).freeze();this.Dv=(new I).freeze();this.Ls=999999999;this.cv=(new I).freeze();this.Hi=this.Gi=this.Fi=!0;this.jf=this.ve=!1;this.qc=null;this.Zg=!0;this.we=!1;this.Nx=new I;this.dv=new I;this.Mc=null;this.bm=1;this.Fv=0;this.ce={scale:1,position:new J,bounds:new L,uw:!1};this.ey=(new L(NaN,NaN,NaN,NaN)).freeze();
this.zm=(new Hb(NaN,NaN)).freeze();this.co=(new L(NaN,NaN,NaN,NaN)).freeze();this.Gs=!1;this.Uo=this.Bo=this.tp=this.Ru=this.Qu=this.Su=this.ng=this.qh=this.qf=null;Ii(this);this.Ob=null;this.Ao=!1;this.Nj=null;this.partManager=new Hi;this.toolManager=new Ta;this.toolManager.initializeStandardTools();this.currentTool=this.defaultTool=this.toolManager;this.js=null;this.pl=new ef;this.Vs=this.Us=null;this.qq=!1;this.commandHandler=Ji();this.Gg=!0;Li(this);this.layout=new Mi;this.Gg=!1;this.model=Ki();
this.model.undoManager=new Me;this.we=!1;this.Tj=!0;this.Ne=!1;this.Yb=1;this.Jh=null;this.gp=1;this.mp=0;this.tv=[0,0,0,0,0];this.np=0;this.yd=1;this.ak=0;this.Po=new J;this.Dt=500;this.Dn=new J;this.xe=!1;this.Dh=this.gm=this.Ch=this.fm=null;this.rq=this.Fo=!1;this.oo=null;this.po=Vb;this.Xb=!1;this.P()};
function Ii(a){a.qf=new Db;var b=new U,c=new ih;c.bind(new Yi("text","",Qa));b.add(c);a.Su=b;a.qf.add("",b);b=new U;c=new ih;c.stroke="brown";c.bind(new Yi("text","",Qa));b.add(c);a.qf.add("Comment",b);b=new U;b.selectable=!1;b.avoidable=!1;c=new Yf;c.figure="Ellipse";c.fill="black";c.stroke=null;c.desiredSize=(new Hb(3,3)).ia();b.add(c);a.qf.add("LinkLabel",b);a.qh=new Db;b=new Hf;b.selectionObjectName="GROUPPANEL";b.type=V.Vertical;c=new ih;c.font="bold 12pt sans-serif";c.bind(new Yi("text","",
Qa));b.add(c);c=new V(V.Auto);c.name="GROUPPANEL";var d=new Yf;d.figure="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new Kg;d.padding=(new lc(5,5,5,5)).ia();c.add(d);b.add(c);a.Qu=b;a.qh.add("",b);a.ng=new Db;b=new R;c=new Yf;c.isPanelMain=!0;b.add(c);c=new Yf;c.toArrow="Standard";c.fill="black";c.stroke=null;c.strokeWidth=0;b.add(c);a.Ru=b;a.ng.add("",b);b=new R;c=new Yf;c.isPanelMain=!0;c.stroke="brown";b.add(c);a.ng.add("Comment",b);b=new Te;b.type=V.Auto;c=new Yf;c.fill=
null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);c=new Kg;c.margin=(new lc(1.5,1.5,1.5,1.5)).ia();b.add(c);a.tp=b;a.Bo=b;b=new Te;b.type=V.Link;c=new Yf;c.isPanelMain=!0;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);a.Uo=b}
Q.prototype.setRTL=function(a){a=void 0===a?this.div:a;null===a&&(a=qa.document.body);var b=ua("div");b.dir="rtl";b.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;";b.textContent="A";a.appendChild(b);var c="reverse";0<b.scrollLeft?c="default":(b.scrollLeft=1,0===b.scrollLeft&&(c="negative"));a.removeChild(b);this.gt=c};
Q.prototype.setScrollWidth=function(a){a=void 0===a?this.div:a;null===a&&(a=qa.document.body);var b=0;if(gh){var c=Zi;b=$i;null===c&&(c=Zi=ua("p"),c.style.width="100%",c.style.height="200px",c.style.boxSizing="content-box",b=$i=ua("div"),b.style.position="absolute",b.style.visibility="hidden",b.style.width="200px",b.style.height="150px",b.style.boxSizing="content-box",b.appendChild(c));b.style.overflow="hidden";a.appendChild(b);var d=c.offsetWidth;b.style.overflow="scroll";c=c.offsetWidth;d===c&&
(c=b.clientWidth);a.removeChild(b);b=d-c;0!==b||eb||(b=11)}this.sb=b;this.Cv=!0};Q.prototype.nb=function(a){a.classType===Q?this.autoScale=a:Ba(this,a)};Q.prototype.toString=function(a){void 0===a&&(a=0);var b="";this.div&&this.div.id&&(b=this.div.id);b='Diagram "'+b+'"';if(0>=a)return b;for(var c=this.Qa.iterator;c.next();)b+="\n  "+c.value.toString(a-1);return b};Q.prototype.addEventListener=function(a,b,c,d){a.addEventListener(b,c,{capture:d,passive:!1})};
Q.prototype.removeEventListener=function(a,b,c,d){a.removeEventListener(b,c,{capture:d})};
function aj(a){var b=a.Aa.La;b instanceof HTMLCanvasElement&&(a.yn?(a.addEventListener(b,"pointerdown",a.Sm,!1),a.addEventListener(b,"pointermove",a.Tm,!1),a.addEventListener(b,"pointerup",a.Vm,!1),a.addEventListener(b,"pointerout",a.Um,!1)):(a.addEventListener(b,"touchstart",a.ax,!1),a.addEventListener(b,"touchmove",a.$w,!1),a.addEventListener(b,"touchend",a.Zw,!1),a.addEventListener(b,"mousemove",a.Ok,!1),a.addEventListener(b,"mousedown",a.Nk,!1),a.addEventListener(b,"mouseup",a.Qk,!1),a.addEventListener(b,
"mouseout",a.Pk,!1)),a.addEventListener(b,"mouseenter",a.$z,!1),a.addEventListener(b,"mouseleave",a.aA,!1),a.addEventListener(b,"wheel",a.Rk,!1),a.addEventListener(b,"keydown",a.RA,!1),a.addEventListener(b,"keyup",a.SA,!1),a.addEventListener(b,"blur",a.Mz,!1),a.addEventListener(b,"focus",a.Nz,!1),a.addEventListener(b,"selectstart",function(a){a.preventDefault();return!1},!1),a.addEventListener(b,"contextmenu",function(a){a.preventDefault();return!1},!1),a.addEventListener(b,"gesturestart",function(b){a.toolManager.gestureBehavior!==
We&&(a.toolManager.gestureBehavior===Ve?b.preventDefault():a.xe&&a.lastInput.handled||(b.preventDefault(),a.bm=a.scale,a.currentTool.doCancel()))},!1),a.addEventListener(b,"gesturechange",function(b){if(a.toolManager.gestureBehavior!==We)if(a.toolManager.gestureBehavior===Ve)b.preventDefault();else if(!a.xe||!a.lastInput.handled){b.preventDefault();var c=b.scale;if(null!==a.bm){var e=a.Aa.getBoundingClientRect();b=new J(b.pageX-qa.scrollX-a.Ea/e.width*e.left,b.pageY-qa.scrollY-a.Da/e.height*e.top);
c=a.bm*c;e=a.commandHandler;if(c!==a.scale&&e.canResetZoom(c)){var f=a.zoomPoint;a.zoomPoint=b;e.resetZoom(c);a.zoomPoint=f}}}},!1),a.addEventListener(qa,"resize",a.kx,!1))}function hf(a){30<a.mp&&(a.Jh=1)}function wf(a,b){null!==a.Jh&&(a.Jh=null,b&&a.mr(),F&&F.yy||(a.mp=0,a.tv=[0,0,0,0,0],a.np=0))}Q.prototype.computePixelRatio=function(){return null!==this.Jh?this.Jh:qa.devicePixelRatio||1};Q.prototype.doMouseMove=function(){this.currentTool.doMouseMove()};Q.prototype.doMouseDown=function(){this.currentTool.doMouseDown()};
Q.prototype.doMouseUp=function(){this.currentTool.doMouseUp()};Q.prototype.doMouseWheel=function(){this.currentTool.doMouseWheel()};Q.prototype.doKeyDown=function(){this.currentTool.doKeyDown()};Q.prototype.doKeyUp=function(){this.currentTool.doKeyUp()};Q.prototype.doFocus=function(){this.focus()};Q.prototype.focus=function(){if(this.Aa)if(this.scrollsPageOnFocus)this.Aa.focus();else{var a=qa.scrollX||qa.pageXOffset,b=qa.scrollY||qa.pageYOffset;this.Aa.focus();qa.scrollTo(a,b)}};Q.prototype.Nz=function(){this.B.U("GainedFocus")};
Q.prototype.Mz=function(){this.B.U("LostFocus")};function Xh(a){if(null!==a.Aa){var b=a.Ja;if(0!==b.clientWidth&&0!==b.clientHeight){a.Cv||a.setScrollWidth();var c=a.jf?a.sb:0,d=a.ve?a.sb:0,e=a.Yb;a.Yb=a.computePixelRatio();a.Yb!==e&&(a.Ll=!0,a.Jb());if(b.clientWidth!==a.Ea+c||b.clientHeight!==a.Da+d)a.Gi=!0,a.Jc=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===Wh&&(a.Qj=!0,b.D()),a.pc||a.Jb()}}}
function Li(a){var b=new wi;b.name="Background";a.Bm(b);b=new wi;b.name="";a.Bm(b);b=new wi;b.name="Foreground";a.Bm(b);b=new wi;b.name="Adornment";b.isTemporary=!0;a.Bm(b);b=new wi;b.name="Tool";b.isTemporary=!0;b.isBoundsIncluded=!0;a.Bm(b);b=new wi;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;a.iy(b,a.Hm("Background"))}
function bj(a){a.Ob=new V(V.Grid);a.Ob.name="GRID";var b=new Yf;b.figure="LineH";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Ob.add(b);b=new Yf;b.figure="LineH";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Ob.add(b);b=new Yf;b.figure="LineH";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Ob.add(b);b=new Yf;b.figure="LineV";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Ob.add(b);b=new Yf;b.figure="LineV";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Ob.add(b);b=new Yf;b.figure=
"LineV";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Ob.add(b);b=new S;b.add(a.Ob);b.layerName="Grid";b.zOrder=0;b.isInDocumentBounds=!1;b.isAnimated=!1;b.pickable=!1;b.locationObjectName="GRID";a.add(b);a.partManager.parts.remove(b);a.Ob.visible=!1}function cj(){this.B.jt?this.B.jt=!1:this.B.isEnabled?this.B.uy(this):dj(this.B)}function ej(a){this.B.isEnabled?(this.B.nt=a.target.scrollTop,this.B.lt=a.target.scrollLeft):dj(this.B)}
Q.prototype.uy=function(a){if(null!==this.Aa){this.Xp=!0;var b=this.documentBounds,c=this.viewportBounds,d=this.cj,e=b.x-d.left,f=b.y-d.top,g=b.width+d.left+d.right,h=b.height+d.top+d.bottom,k=b.right+d.right;d=b.bottom+d.bottom;var l=c.x;b=c.y;var m=c.width,n=c.height,p=c.right,r=c.bottom;c=this.scale;var q=a.scrollLeft;if(this.Nl)switch(this.gt){case "negative":q=q+a.scrollWidth-a.clientWidth;break;case "reverse":q=a.scrollWidth-q-a.clientWidth}var u=q;m<g||n<h?(q=J.allocAt(this.position.x,this.position.y),
this.allowHorizontalScroll&&this.lt!==u&&(q.x=u/c+e,this.lt=u),this.allowVerticalScroll&&this.nt!==a.scrollTop&&(q.y=a.scrollTop/c+f,this.nt=a.scrollTop),this.position=q,J.free(q),this.Gi=this.Xp=!1):(q=J.alloc(),a.uz&&this.allowHorizontalScroll&&(e<l&&(this.position=q.h(u+e,this.position.y)),k>p&&(this.position=q.h(-(this.mt.scrollWidth-this.Ea)+u-this.Ea/c+k,this.position.y))),a.vz&&this.allowVerticalScroll&&(f<b&&(this.position=q.h(this.position.x,a.scrollTop+f)),d>r&&(this.position=q.h(this.position.x,
-(this.mt.scrollHeight-this.Da)+a.scrollTop-this.Da/c+d))),J.free(q),fj(this),this.Gi=this.Xp=!1,b=this.documentBounds,c=this.viewportBounds,k=b.right,p=c.right,d=b.bottom,r=c.bottom,e=b.x,l=c.x,f=b.y,b=c.y,m>=g&&e>=l&&k<=p&&(this.Yp.style.width="1px"),n>=h&&f>=b&&d<=r&&(this.Yp.style.height="1px"))}};Q.prototype.computeBounds=function(){0<this.xd.count&&gj(this);return hj(this)};
function hj(a){if(a.fixedBounds.o()){var b=a.fixedBounds.copy();b.Fq(a.mb);return b}for(var c=!0,d=a.Qa.j,e=d.length,f=0;f<e;f++){var g=d[f];if(g.visible&&(!g.isTemporary||g.isBoundsIncluded)){g=g.Ia.j;for(var h=g.length,k=0;k<h;k++){var l=g[k];l.isInDocumentBounds&&l.isVisible()&&(l=l.actualBounds,l.o()&&(c?(c=!1,b=l.copy()):b.Uc(l)))}}}c&&(b=new L(0,0,0,0));b.Fq(a.mb);return b}
Q.prototype.computePartsBounds=function(a,b){void 0===b&&(b=!1);var c=null;if(Ga(a))for(var d=0;d<a.length;d++){var e=a[d];!b&&e instanceof R||(e.Ya(),null===c?c=e.actualBounds.copy():c.Uc(e.actualBounds))}else for(a=a.iterator;a.next();)d=a.value,!b&&d instanceof R||(d.Ya(),null===c?c=d.actualBounds.copy():c.Uc(d.actualBounds));return null===c?new L(NaN,NaN,0,0):c};
function ij(a,b){if((b||a.we)&&!a.Xb&&null!==a.Aa&&a.documentBounds.o()){if(b){var c=a.initialPosition;if(c.o()){a.position=c;return}c=J.alloc();c.Ej(a.documentBounds,a.initialDocumentSpot);var d=a.viewportBounds;d=L.allocAt(0,0,d.width,d.height);var e=J.alloc();e.Ej(d,a.initialViewportSpot);e.h(c.x-e.x,c.y-e.y);a.position=e;L.free(d);J.free(e);J.free(c)}a.Xb=!0;c=a.$g;b&&a.jg!==Wh&&(c=a.jg);d=c!==Wh?jj(a,c):a.scale;c=a.viewportBounds.copy();e=a.Ea/d;var f=a.Da/d,g=a.Mj,h=a.Do;b&&!g.cb()&&(h.cb()||
h.Ib())&&(g=h.Ib()?Mc:h);kj(a,a.documentBounds,e,f,g,b);b=a.scale;a.scale=d;a.Xb=!1;d=a.viewportBounds;d.Ta(c)||a.ir(c,d,b,!1);lj(a);mj(a,!0,!1)}}
function jj(a,b){var c=a.bo;if(null===a.Aa)return c;a.Ya();var d=a.documentBounds;if(!d.o())return c;var e=d.width;d=d.height;var f=a.Ea+(a.jf?a.sb:0),g=a.Da+(a.ve?a.sb:0),h=f/e,k=g/d;return b===nj?(b=Math.min(k,h),b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):b===oj?(b=k>h?(g-a.sb)/d:(f-a.sb)/e,b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):a.scale}
Q.prototype.zoomToFit=function(){var a=this.dj;this.dj=mi;this.scale=jj(this,nj);a!==mi&&(ij(this,!1),kj(this,this.documentBounds,this.Ea/this.Fa,this.Da/this.Fa,this.Mj,!1));this.dj=a};t=Q.prototype;
t.zB=function(a,b){void 0===b&&(b=nj);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===nj||b===oj)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.Ea;var f=this.Da;e=b===oj?f/d>e/c?(f-(this.ve?this.sb:0))/d:(e-(this.jf?this.sb:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new J(a.x,a.y)}};
t.Fz=function(a,b){this.Ya();var c=this.documentBounds,d=this.viewportBounds;this.position=new J(c.x+(a.x*c.width+a.offsetX)-(b.x*d.width-b.offsetX),c.y+(a.y*c.height+a.offsetY)-(b.y*d.height-b.offsetY))};t.zA=function(a){if(a instanceof N){this.oo=a;var b=J.alloc();this.po=this.xr(a.ma(Hc,b));J.free(b)}else this.oo=null,this.po=Vb};
function kj(a,b,c,d,e,f){var g=J.allocAt(a.ra.x,a.ra.y),h=g.x,k=g.y;if(null!==a.oo){var l=J.alloc();l=a.oo.ma(Hc,l);h=l.x-a.po.x/a.scale;k=l.y-a.po.y/a.scale;e=Gc;J.free(l)}if(f||a.scrollMode===mi)e.cb()&&(c>b.width&&(h=b.x+(e.x*b.width+e.offsetX)-(e.x*c-e.offsetX)),d>b.height&&(k=b.y+(e.y*b.height+e.offsetY)-(e.y*d-e.offsetY))),e=a.cj,f=c-b.width,c<b.width+e.left+e.right?(h=Math.min(h+c/2,b.right+Math.max(f,e.right)-c/2),h=Math.max(h,b.left-Math.max(f,e.left)+c/2),h-=c/2):h>b.left?h=b.left:h<b.right-
c&&(h=b.right-c),c=d-b.height,d<b.height+e.top+e.bottom?(k=Math.min(k+d/2,b.bottom+Math.max(c,e.bottom)-d/2),k=Math.max(k,b.top-Math.max(c,e.top)+d/2),k-=d/2):k>b.top?k=b.top:k<b.bottom-d&&(k=b.bottom-d);g.x=isFinite(h)?h:-a.mb.left;g.y=isFinite(k)?k:-a.mb.top;null!==a.positionComputation&&(b=a.positionComputation(a,g),g.x=b.x,g.y=b.y);a.Xc.xc&&fi(a.Xc,a.ra,g);a.ra.h(g.x,g.y);J.free(g)}
t.Im=function(a,b){void 0===b&&(b=!0);if(b){if(a=If(this,a,function(a){return a.part},function(a){return a.canSelect()}),a instanceof S)return a}else if(a=If(this,a,function(a){return a.part}),a instanceof S)return a;return null};t.$b=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);gj(this);for(var d=this.Qa.iteratorBackwards;d.next();){var e=d.value;if(e.visible&&(e=e.$b(a,b,c),null!==e))return e}return null};
function If(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);gj(a);for(a=a.Qa.iteratorBackwards;a.next();){var e=a.value;if(e.visible&&!e.isTemporary&&(e=e.$b(b,c,d),null!==e))return e}return null}t.nA=function(a,b,c){void 0===b&&(b=!0);return pj(this,a,function(a){return a.part},b?function(a){return a instanceof S&&a.canSelect()}:null,c)};
function pj(a,b,c,d,e){void 0===c&&(c=null);void 0===d&&(d=null);e instanceof H||e instanceof I||(e=new I);gj(a);for(a=a.Qa.iteratorBackwards;a.next();){var f=a.value;f.visible&&!f.isTemporary&&f.sj(b,c,d,e)}return e}t.sj=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof H||d instanceof I||(d=new I);gj(this);for(var e=this.Qa.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.sj(a,b,c,d)}return d};
t.Fy=function(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!0);return qj(this,a,function(a){return a instanceof S&&(!c||a.canSelect())},b,d)};t.Lf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof H||e instanceof I||(e=new I);gj(this);for(var f=this.Qa.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.Lf(a,b,c,d,e)}return e};
t.iw=function(a,b,c,d,e,f){var g=new I;gj(this);for(var h=this.Qa.iteratorBackwards;h.next();){var k=h.value;k.visible&&k.iw(a,b,c,d,g,e,f)}return g};function qj(a,b,c,d,e){var f=null;void 0===f&&(f=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof H||e instanceof I||(e=new I);gj(a);for(a=a.Qa.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.Lf(b,f,c,d,e)}return e}
t.oA=function(a,b,c,d,e){void 0===c&&(c=!0);void 0===d&&(d=!0);return rj(this,a,b,function(a){return a instanceof S&&(!d||a.canSelect())},c,e)};t.Qg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof H||e instanceof I)f=e;e=!0}f instanceof H||f instanceof I||(f=new I);gj(this);for(var g=this.Qa.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.Qg(a,b,c,d,e,f)}return f};
function rj(a,b,c,d,e,f){var g=null;void 0===g&&(g=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof H||e instanceof I)f=e;e=!0}f instanceof H||f instanceof I||(f=new I);gj(a);for(a=a.Qa.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.Qg(b,c,g,d,e,f)}return f}Q.prototype.acceptEvent=function(a){return sj(this,a,a instanceof MouseEvent)};
function sj(a,b,c){var d=a.be;a.be=a.sh;a.sh=d;d.diagram=a;d.event=b;c?tj(a,b,d):(d.viewPoint=a.be.viewPoint,d.documentPoint=a.be.documentPoint);a=0;b.ctrlKey&&(a+=1);b.altKey&&(a+=2);b.shiftKey&&(a+=4);b.metaKey&&(a+=8);d.modifiers=a;d.button=b.button;void 0===b.buttons||Za||(d.buttons=b.buttons);db&&0===b.button&&b.ctrlKey&&(d.button=2);d.down=!1;d.up=!1;d.clickCount=1;d.delta=0;d.handled=!1;d.bubbles=!1;d.timestamp=b.timeStamp;d.isMultiTouch=!1;d.targetDiagram=uj(b);d.targetObject=null;return d}
function uj(a){var b=a.target.B;if(!b){var c=a.path;c||"function"!==typeof a.composedPath||(c=a.composedPath());c&&c[0]&&(b=c[0].B)}return b?b:null}function vj(a,b,c,d){var e=wj(a,b,!0,!1,!0,d);tj(a,c,e);e.targetDiagram=uj(b);e.targetObject=null;d||e.clone(a.gg);return e}
function xj(a,b,c,d){var e;d=wj(a,b,!1,!1,!1,d);null!==c?((e=qa.document.elementFromPoint(c.clientX,c.clientY))&&e.B?(b=c,c=e.B):(b=void 0!==b.targetTouches?b.targetTouches[0]:b,c=a),d.targetDiagram=c,tj(a,b,d)):null!==a.be?(d.documentPoint=a.be.documentPoint,d.viewPoint=a.be.viewPoint,d.targetDiagram=a.be.targetDiagram):null!==a.gg&&(d.documentPoint=a.gg.documentPoint,d.viewPoint=a.gg.viewPoint,d.targetDiagram=a.gg.targetDiagram);d.targetObject=null;return d}
function wj(a,b,c,d,e,f){var g=a.be;a.be=a.sh;a.sh=g;g.diagram=a;g.clickCount=1;var h=g.delta=0;b.ctrlKey&&(h+=1);b.altKey&&(h+=2);b.shiftKey&&(h+=4);b.metaKey&&(h+=8);g.modifiers=h;g.button=0;g.buttons=1;g.event=b;g.timestamp=b.timeStamp;a.yn&&b instanceof qa.PointerEvent&&"touch"!==b.pointerType&&(g.button=b.button,void 0===b.buttons||Za||(g.buttons=b.buttons),db&&0===b.button&&b.ctrlKey&&(g.button=2));g.down=c;g.up=d;g.handled=!1;g.bubbles=e;g.isMultiTouch=f;return g}
function yj(a,b,c){if(b.bubbles)return F&&F.Py&&Ca("NOT handled "+c.type+" "+b.toString()),!0;F&&F.Py&&Ca("handled "+c.type+" "+a.currentTool.name+" "+b.toString());void 0!==c.stopPropagation&&c.stopPropagation();!1!==c.cancelable&&c.preventDefault();c.cancelBubble=!0;return!1}
Q.prototype.RA=function(a){var b=this.B;if(!this.B.isEnabled)return!1;var c=sj(b,a,!1);c.key=String.fromCharCode(a.which);c.down=!0;switch(a.which){case 8:c.key="Backspace";break;case 33:c.key="PageUp";break;case 34:c.key="PageDown";break;case 35:c.key="End";break;case 36:c.key="Home";break;case 37:c.key="Left";break;case 38:c.key="Up";break;case 39:c.key="Right";break;case 40:c.key="Down";break;case 45:c.key="Insert";break;case 46:c.key="Del";break;case 48:c.key="0";break;case 187:case 61:case 107:c.key=
"Add";break;case 189:case 173:case 109:c.key="Subtract";break;case 27:c.key="Esc"}b.doKeyDown();return yj(b,c,a)};
Q.prototype.SA=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=sj(b,a,!1);c.key=String.fromCharCode(a.which);c.up=!0;switch(a.which){case 8:c.key="Backspace";break;case 33:c.key="PageUp";break;case 34:c.key="PageDown";break;case 35:c.key="End";break;case 36:c.key="Home";break;case 37:c.key="Left";break;case 38:c.key="Up";break;case 39:c.key="Right";break;case 40:c.key="Down";break;case 45:c.key="Insert";break;case 46:c.key="Del"}b.doKeyUp();return yj(b,c,a)};
Q.prototype.$z=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=sj(b,a,!0);null!==b.mouseEnter&&b.mouseEnter(c);return yj(b,c,a)};Q.prototype.aA=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=sj(b,a,!0);null!==b.mouseLeave&&b.mouseLeave(c);return yj(b,c,a)};
Q.prototype.getMouse=function(a){var b=this.Aa;if(null===b)return new J(0,0);var c=b.getBoundingClientRect();b=a.clientX-this.Ea/c.width*c.left;a=a.clientY-this.Da/c.height*c.top;return null!==this.tb?Jb(new J(b,a),this.tb):new J(b,a)};
function tj(a,b,c){var d=a.Aa,e=a.Ea,f=a.Da,g=0,h=0;null!==d&&(d=d.getBoundingClientRect(),g=b.clientX-e/d.width*d.left,h=b.clientY-f/d.height*d.top);c.viewPoint.h(g,h);null!==a.tb?(b=J.allocAt(g,h),a.tb.ge(b),c.documentPoint.assign(b),J.free(b)):c.documentPoint.h(g,h)}
function xe(a,b,c,d){if(void 0!==b.targetTouches){if(2>b.targetTouches.length)return;b=b.targetTouches[c]}else if(null!==a.kk[0])b=a.kk[c];else return;c=a.Aa;null!==c&&(c=c.getBoundingClientRect(),d.h(b.clientX-a.Ea/c.width*c.left,b.clientY-a.Da/c.height*c.top))}t=Q.prototype;t.Ua=function(){this.Fi||(this.Fi=!0,this.Jb(!0))};function zj(a){a.pc||gj(a);a.Ya()}t.We=function(){this.Xb||this.pc||(this.P(),lj(this),fj(this),this.Ua(),this.jd())};t.QA=function(){return this.Ne};
t.Vz=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.Tc();b.isEnabled=!1;Qf(this);this.we=!1;this.ht=new J(NaN,NaN);b.isEnabled=c;this.pc=!0;var d=this;null!==a&&ta(function(){d.pc=!1;Eh(b,"Model");a()},1)};t.Jb=function(a){void 0===a&&(a=!1);if(!0!==this.Ne&&!(this.Xb||!1===a&&this.pc)){this.Ne=!0;var b=this;qa.requestAnimationFrame(function(){b.Ne&&b.jd()})}};t.jd=function(){if(!this.Tj||this.Ne)this.Tj&&(this.Tj=!1),Qf(this)};
function mj(a,b,c){a.animationManager.defaultAnimation.isAnimating||a.Xb||!a.Gi||dj(a)||(b&&gj(a),c&&ij(a,!1))}
function Qf(a,b){if(!a.pc&&(a.Ne=!1,null!==a.Ja||a.zm.o())){a.pc=!0;var c=a.animationManager,d=a.$s;if(!c.isAnimating&&0!==d.length){for(var e=d.j,f=e.length,g=0;g<f;g++){var h=e[g];Aj(h,!1);h.v()}d.clear()}d=a.dv;0<d.count&&(d.each(function(a){a.jx()}),d.clear());e=d=!1;c.isAnimating&&(e=!0,d=a.skipsUndoManager,a.skipsUndoManager=!0);c.xc||Xh(a);mj(a,!1,!0);null!==a.Ob&&(a.Ob.visible&&!a.Ao&&(Bj(a),a.Ao=!0),!a.Ob.visible&&a.Ao&&(a.Ao=!1));gj(a);f=!1;if(!a.we||a.Zg)a.we?Cj(a,!a.Qj):(a.Ca("Initial Layout"),
!1===c.isEnabled&&c.Tc(),Cj(a,!1)),f=!0;a.Qj=!1;gj(a);a.tt||zj(a);mj(a,!0,!1);g=!1;f?(c=L.alloc(),c.assign(a.viewportBounds),a.we||(g=a.we=!0,a.skipsUndoManager||(a.undoManager.isPendingClear=!0),a.undoManager.isPendingUnmodified=!0,Dj(a)),a.U("LayoutCompleted"),c.A(a.viewportBounds)||mj(a,!0,!1),L.free(c)):c.Gl&&c.by&&(a.jg!==Wh?a.scale=jj(a,a.jg):a.$g!==Wh?a.scale=jj(a,a.$g):(c=a.initialScale,isFinite(c)&&0<c&&(a.scale=c)),ij(a,!0));gj(a);f&&g&&a.bb("Initial Layout");a.Tv();b||a.hc(a.Mb);e&&(a.skipsUndoManager=
d);a.pc=!1}}function Dj(a){var b=a.Fa;if(a.jg!==Wh)a.scale=jj(a,a.jg);else if(a.$g!==Wh)a.scale=jj(a,a.$g);else{var c=a.initialScale;isFinite(c)&&0<c&&(a.scale=c)}a.Fa!==b&&(lj(a),mj(a,!0,!1));ij(a,!0);b=a.Qa.j;a.Md(b,b.length,a);a.U("InitialLayoutCompleted");a.ht.assign(a.ra);Bj(a)}
function gj(a){if((a.pc||!a.animationManager.isTicking)&&0!==a.xd.count){for(var b=0;23>b;b++){var c=a.xd.iterator;if(null===c||0===a.xd.count)break;a.xd=new I;a.jx(c,a.xd);F&&22===b&&Ca("failure to validate parts")}a.nodes.each(function(a){a instanceof Hf&&0!==(a.T&65536)!==!1&&(a.T=a.T^65536)})}}
t.jx=function(a,b){for(a.reset();a.next();){var c=a.value;!c.bc()||c instanceof Hf||(c.Cj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof Hf&&c.isVisible()&&Ej(this,c);for(a.reset();a.next();)c=a.value,c instanceof R&&c.isVisible()&&(c.Cj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof Te&&c.isVisible()&&(c.Cj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))};
function Ej(a,b){for(var c=La(),d=La(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof Hf?(Fj(f)||Gj(f)||Hj(f))&&Ej(a,f):f instanceof R?f.fromNode===b||f.toNode===b?d.push(f):c.push(f):(f.measure(Infinity,Infinity),f.arrange()))}a=c.length;for(e=0;e<a;e++)f=c[e],f.measure(Infinity,Infinity),f.arrange();Oa(c);b.measure(Infinity,Infinity);b.arrange();a=d.length;for(b=0;b<a;b++)c=d[b],c.measure(Infinity,Infinity),c.arrange();Oa(d)}
t.Md=function(a,b,c,d){if(this.Hi||this.animationManager.isAnimating){void 0===d&&(d=c.viewportBounds);for(var e=0;e<b;e++)a[e].Md(c,d)}};
t.hc=function(a,b){void 0===b&&(b=null);if(null!==this.Ja){null===this.Aa&&v("No canvas specified");var c=this.animationManager;if(!c.xc&&(!c.isAnimating||c.isTicking)){var d=new Date;Ij(this);if("0"!==this.Ja.style.opacity){var e=a!==this.Mb,f=this.Qa.j,g=f.length,h=this;this.Md(f,g,h);if(e)a.zc(!0),fj(this);else if(!this.Jc&&null===b&&!c.isAnimating)return;g=this.ra;var k=this.Fa,l=Math.round(g.x*k)/k,m=Math.round(g.y*k)/k;c=this.tb;c.reset();1!==k&&c.scale(k);0===g.x&&0===g.y||c.translate(-l,-m);
k=this.Yb;a.setTransform(1,0,0,1,0,0);a.scale(k,k);a.clearRect(0,0,this.Ea,this.Da);a.setTransform(1,0,0,1,0,0);a.scale(k,k);a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy);F&&F.Dm&&F.aw&&F.aw(this,a);Jj(this,a);a.globalAlpha=this.yb;l=null!==b?function(c){var d=b;if(c.visible&&0!==c.yb){var e=c.Ia.j,f=e.length;if(0!==f){var g=yi(c,a),k=c.Bp;k.length=0;for(var l=h.scale,m=L.alloc(),n=0;n<f;n++){var D=e[n];d.contains(D)||c.oj(a,D,h,k,l,m,!0)}L.free(m);a.globalAlpha=g}}}:function(b){b.hc(a,h)};g=f.length;
for(m=0;m<g;m++)a.setTransform(1,0,0,1,0,0),a.scale(k,k),a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),l(f[m]);this.Ei&&Kj(this.Ei,this)&&this.ks();F&&(F.zy||F.Dm)&&F.bw&&F.bw(a,this,c);e?(this.Mb.zc(!0),fj(this)):this.Jc=this.Hi=!1;f=+new Date-+d;e=F&&F.yy;d=this.tv;if(e||null===this.Jh){d[this.np]=f;this.np=(this.np+1)%d.length;for(c=f=0;c<d.length;c++)f+=d[c];this.mp=f/d.length}if(e)for(a.setTransform(1,0,0,1,0,0),e=0;e<d.length;e++)a.fillText(d[e].toString(),20,150+ +(20*e))}}}};
function Lj(a,b,c,d,e,f,g,h,k,l){if(null!==a.Ja){null===a.Aa&&v("No canvas specified");void 0===g&&(g=null);void 0===h&&(h=null);void 0===k&&(k=!1);void 0===l&&(l=!1);Ij(a);a.Mb.zc(!0);fj(a);a.Ii=!0;var m=a.Fa;a.Fa=e;var n=a.Qa.j,p=n.length;try{var r=new L(f.x,f.y,d.width/e,d.height/e),q=r.copy();q.Fq(c);Bj(a,q);gj(a);a.Md(n,p,a,r);b.setTransform(1,0,0,1,0,0);b.clearRect(0,0,d.width,d.height);null!==h&&""!==h&&(b.fillStyle=h,b.fillRect(0,0,d.width,d.height));var u=a.Yb;b.scale(u,u);var w=Ib.alloc();
w.reset();w.translate(c.left,c.top);w.scale(e);0===f.x&&0===f.y||w.translate(-f.x,-f.y);b.setTransform(w.m11,w.m12,w.m21,w.m22,w.dx,w.dy);Ib.free(w);Jj(a,b);b.globalAlpha=a.yb;if(null!==g){var y=new I,z=g.iterator;for(z.reset();z.next();){var B=z.value;!1===l&&"Grid"===B.layer.name||null===B||y.add(B)}var D=function(c){if(c.visible&&0!==c.yb&&(k||!c.isTemporary)){var d=c.Ia.j,e=d.length;if(0!==e){var f=yi(c,b),g=c.Bp;g.length=0;for(var h=a.scale,l=L.alloc(),m=0;m<e;m++){var n=d[m];y.contains(n)&&
c.oj(b,n,a,g,h,l,!1)}L.free(l);b.globalAlpha=f}}}}else if(!k&&l){var G=a.grid.part,O=G.layer;D=function(c){c===O?G.hc(b,a):c.hc(b,a,k)}}else D=function(c){c.hc(b,a,k)};for(c=0;c<p;c++)D(n[c]);a.Ii=!1;a.Ei&&Kj(a.Ei,a)&&a.ks()}finally{a.Fa=m,a.Mb.zc(!0),fj(a),a.Md(n,p,a),Bj(a)}}}t.Te=function(a){return this.uf[a]};t.fz=function(a,b){"minDrawingLength"===a&&(this.gp=b);this.uf[a]=b;this.We()};
t.Kw=function(){this.uf=new jb;this.uf.drawShadows=!0;this.uf.textGreeking=!0;this.uf.viewportOptimizations=eb||$a||bb?!1:!0;this.uf.temporaryPixelRatio=!0;this.uf.pictureRatioOptimization=!0;this.gp=this.uf.minDrawingLength=1};function Jj(a,b){a=a.uf;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.ez(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.Lm=function(a){return this.Wj[a]};t.nB=function(a,b){this.Wj[a]=b};
t.Jw=function(){this.Wj=new jb;this.Wj.extraTouchArea=10;this.Wj.extraTouchThreshold=10;this.Wj.hasGestureZoom=!0};t.Sw=function(a){Mj(this,a)};
function Mj(a,b){var c=a instanceof V,d=a instanceof Q,e;for(e in b){""===e&&v("Setting properties requires non-empty property names");var f=a,g=e;if(c||d){var h=e.indexOf(".");if(0<h){var k=e.substring(0,h);if(c)f=a.gb(k);else if(f=a[k],void 0===f||null===f)f=a.toolManager[k];Fa(f)?g=e.substr(h+1):v("Unable to find object named: "+k+" in "+a.toString()+" when trying to set property: "+e)}}if("_"!==g[0]&&!Ra(f,g))if(d&&"ModelChanged"===g){a.ly(b[g]);continue}else if(d&&"Changed"===g){a.Sh(b[g]);continue}else if(d&&
Ra(a.toolManager,g))f=a.toolManager;else if(d&&Nj(a,g)){a.uk(g,b[g]);continue}else if(a instanceof W&&"Changed"===g){a.Sh(b[g]);continue}else v('Trying to set undefined property "'+g+'" on object: '+f.toString());f[g]=b[e];"_"===g[0]&&f instanceof N&&f.hy(g)}}t.Tv=function(){if(0===this.undoManager.transactionLevel&&0!==this.hh.count){for(;0<this.hh.count;){var a=this.hh;this.hh=new Db;for(a=a.iterator;a.next();){var b=a.key;b.$q(a.value);b.ic()}}this.P()}};
t.P=function(a){void 0===a&&(a=null);if(null===a)this.Jc=!0,this.Jb();else{var b=this.viewportBounds;null!==a&&a.o()&&b.Rc(a)&&(this.Jc=!0,this.Jb())}this.U("InvalidateDraw")};
t.Ry=function(a,b){if(!0!==this.Jc){this.Jc=!0;var c=!0===this.Te("temporaryPixelRatio");if(!0===this.Te("viewportOptimizations")&&this.scrollMode!==oi&&this.cj.qj(0,0,0,0)&&b.width===a.width&&b.height===a.height){var d=this.scale,e=Math.max(a.x,b.x),f=Math.max(a.y,b.y);d=L.allocAt(e,f,Math.max(0,Math.min(a.x+a.width,b.x+b.width)-e)*d,Math.max(0,Math.min(a.y+a.height,b.y+b.height)-f)*d);if(!this.rq&&0<d.width&&0<d.height){if(!(this.pc||(this.Ne=!1,null===this.Ja||(this.pc=!0,this.Tv(),this.documentBounds.o()||
Oj(this,this.computeBounds()),e=this.Aa,null===e||e instanceof Pj)))){var g=this.Yb;f=this.Ea*g;var h=this.Da*g,k=this.scale*g,l=Math.round(Math.round(b.x*k)-Math.round(a.x*k));b=Math.round(Math.round(b.y*k)-Math.round(a.y*k));k=this.Vu;a=this.Gx;k.width!==f&&(k.width=f);k.height!==h&&(k.height=h);a.clearRect(0,0,f,h);k=190*g;var m=70*g,n=Math.max(l,0),p=Math.max(b,0),r=Math.floor(f-n),q=Math.floor(h-p);a.drawImage(e.La,n,p,r,q,0,0,r,q);Kj(this.Ei,this)&&a.clearRect(0,0,k,m);e=La();a=La();q=Math.abs(l);
r=Math.abs(b);var u=0===n?0:f-q;n=J.allocAt(u,0);q=J.allocAt(q+u,h);a.push(new L(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));var w=this.tb;w.reset();w.scale(g,g);1!==this.Fa&&w.scale(this.Fa);g=this.ra;(0!==g.x||0!==g.y)&&isFinite(g.x)&&isFinite(g.y)&&w.translate(-g.x,-g.y);Jb(n,w);Jb(q,w);e.push(new L(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));u=0===p?0:h-r;n.h(0,u);q.h(f,r+u);a.push(new L(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-
q.x),Math.abs(n.y-q.y)));Jb(n,w);Jb(q,w);e.push(new L(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));Kj(this.Ei,this)&&(f=0<l?0:-l,h=0<b?0:-b,n.h(f,h),q.h(k+f,m+h),a.push(new L(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))),Jb(n,w),Jb(q,w),e.push(new L(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))));J.free(n);J.free(q);mj(this,!1,!0);null===this.Ja&&v("No div specified");null===this.Aa&&v("No canvas specified");if(!this.animationManager.xc&&
(f=this.Mb,this.Jc)){Ij(this);h=this.Yb;f.setTransform(1,0,0,1,0,0);f.clearRect(0,0,this.Ea*h,this.Da*h);f.drawImage(this.Vu.La,0<l?0:Math.round(-l),0<b?0:Math.round(-b));b=this.ra;g=this.Fa;k=Math.round(b.x*g)/g;m=Math.round(b.y*g)/g;l=this.tb;l.reset();1!==g&&l.scale(g);0===b.x&&0===b.y||l.translate(-k,-m);f.save();f.beginPath();b=a.length;for(g=0;g<b;g++)k=a[g],0!==k.width&&0!==k.height&&f.rect(Math.floor(k.x),Math.floor(k.y),Math.ceil(k.width),Math.ceil(k.height));f.clip();f.setTransform(1,0,
0,1,0,0);f.scale(h,h);f.transform(l.m11,l.m12,l.m21,l.m22,l.dx,l.dy);F&&F.Dm&&F.aw&&F.aw(this,f);h=this.Qa.j;b=h.length;this.Md(h,b,this);Jj(this,f);f.globalAlpha=this.yb;for(g=0;g<b;g++)if(k=h[g],m=e,k.visible&&0!==k.yb){p=yi(k,f);n=k.Bp;n.length=0;r=this.scale;q=L.alloc();w=k.Ia.j;u=w.length;for(var y=m.length,z=0;z<u;z++){var B=w[z];a:{var D=Qj(B,B.actualBounds);for(var G=m,O=y,T=2/r,P=4/r,ba=0;ba<O;ba++){var Y=G[ba];if(0!==Y.width&&0!==Y.height&&D.qw(Y.x-T,Y.y-T,Y.width+P,Y.height+P)){D=!0;break a}}D=
!1}D&&k.oj(f,B,this,n,r,q,!0)}L.free(q);f.globalAlpha=p}f.restore();f.zc(!0);F&&(F.zy||F.Dm)&&F.bw&&F.bw(f,this,l);this.Ei&&Kj(this.Ei,this)&&this.ks();this.Jc=this.Hi=!1;this.mr()}Oa(e);Oa(a);this.pc=!1}}else this.jd();L.free(d);c&&(hf(this),this.jd(),wf(this,!0))}else c?(hf(this),this.jd(),wf(this,!0)):this.jd()}};function lj(a){!1===a.Gi&&(a.Gi=!0)}function fj(a){!1===a.Hi&&(a.Hi=!0)}function Ij(a){!1!==a.Ll&&(a.Ll=!1,Rj(a,a.Ea,a.Da))}
function Rj(a,b,c){var d=a.Yb;a.Aa.resize(b*d,c*d,b,c)&&(a.Jc=!0,a.Mb.zc(!0))}
function dj(a){var b=a.Aa;if(null===b)return!0;var c=a.Ja,d=a.Ea,e=a.Da,f=a.viewportBounds.copy();if(!f.o())return!0;var g=!1,h=a.jf?a.sb:0,k=a.ve?a.sb:0,l=c.clientWidth||d+h,m=c.clientHeight||e+k;if(l!==d+h||m!==e+k)a.jf=!1,a.ve=!1,k=h=0,a.Ea=l,a.Da=m,g=a.Ll=!0;if(!(g||a.jf||a.ve||a.Cl||a.Dl))return!0;a.Gi=!1;var n=a.viewportBounds,p=a.documentBounds,r=0,q=0,u=0,w=0;c=n.width;var y=n.height,z=a.cj;a.contentAlignment.cb()?(p.width>c&&(r=z.left,q=z.right),p.height>y&&(u=z.top,w=z.bottom)):(r=z.left,
q=z.right,u=z.top,w=z.bottom);z=p.width+r+q;var B=p.height+u+w;r=p.x-r;var D=n.x;q=p.right+q;var G=n.right+h;u=p.y-u;var O=n.y;p=p.bottom+w;n=n.bottom+k;var T="1px",P="1px";w=a.scale;l=z>l/w;m=B>m/w;a.scrollMode===mi&&(l||m)&&(l&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(l=1,r+1<D&&(l=Math.max((D-r)*w+a.Ea,l)),q>G+1&&(l=Math.max((q-G)*w+a.Ea,l)),c+h+1<z&&(l=Math.max((z-c)*w+a.Ea,l)),T=l.toString()+"px"),m&&a.hasVerticalScrollbar&&a.allowVerticalScroll&&(l=1,u+1<O&&(l=Math.max((O-u)*w+a.Da,
l)),p>n+1&&(l=Math.max((p-n)*w+a.Da,l)),y+k+1<B&&(l=Math.max((B-y)*w+a.Da,l)),P=l.toString()+"px"));l="1px"!==T;m="1px"!==P;l&&m||!l&&!m||(m&&(G-=a.sb),l&&(n-=a.sb),z<c+h||!a.hasHorizontalScrollbar||!a.allowHorizontalScroll||(h=1,r+1<D&&(h=Math.max((D-r)*w+a.Ea,h)),q>G+1&&(h=Math.max((q-G)*w+a.Ea,h)),c+1<z&&(h=Math.max((z-c)*w+a.Ea,h)),T=h.toString()+"px"),l="1px"!==T,h=a.Da,l!==a.ve&&(h=l?a.Da-a.sb:a.Da+a.sb),B<y+k||!a.hasVerticalScrollbar||!a.allowVerticalScroll||(k=1,u+1<O&&(k=Math.max((O-u)*w+
h,k)),p>n+1&&(k=Math.max((p-n)*w+h,k)),y+1<B&&(k=Math.max((B-y)*w+h,k)),P=k.toString()+"px"),m="1px"!==P);if(a.Xp&&l===a.ve&&m===a.jf)return d===a.Ea&&e===a.Da||a.jd(),!1;l!==a.ve&&("1px"===T?a.Da=a.Da+a.sb:a.Da=Math.max(a.Da-a.sb,1),g=!0);a.ve=l;a.Yp.style.width=T;m!==a.jf&&("1px"===P?a.Ea=a.Ea+a.sb:a.Ea=Math.max(a.Ea-a.sb,1),g=!0,a.Nl&&(k=J.alloc(),m?(b.style.left=a.sb+"px",a.position=k.h(a.ra.x+a.sb/a.scale,a.ra.y)):(b.style.left="0px",a.position=k.h(a.ra.x-a.sb/a.scale,a.ra.y)),J.free(k)));a.jf=
m;a.Yp.style.height=P;a.jt=!0;g&&(a.Ll=!0);b=a.mt;k=b.scrollLeft;a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(c+1<z?k=(a.position.x-r)*w:r+1<D?k=b.scrollWidth-b.clientWidth:q>G+1&&(k=a.position.x*w));if(a.Nl)switch(a.gt){case "negative":k=-(b.scrollWidth-k-b.clientWidth);break;case "reverse":k=b.scrollWidth-k-b.clientWidth}b.scrollLeft=k;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(y+1<B?b.scrollTop=(a.position.y-u)*w:u+1<O?b.scrollTop=b.scrollHeight-b.clientHeight:p>n+1&&(b.scrollTop=a.position.y*
w));l=a.Ea;m=a.Da;b.style.width=l+(a.jf?a.sb:0)+"px";b.style.height=m+(a.ve?a.sb:0)+"px";return d!==l||e!==m||a.animationManager.xc?(a.ir(f,a.viewportBounds,w,g),!1):!0}
t.add=function(a){x(a,S,Q,"add:part");var b=a.diagram;if(b!==this&&(null!==b&&v("Cannot add part "+a.toString()+" to "+this.toString()+". It is already a part of "+b.toString()),b=this.Hm(a.layerName),null===b&&(b=this.Hm("")),null===b&&v('Cannot add a Part when unable find a Layer named "'+a.layerName+'" and there is no default Layer'),a.layer!==b)){var c=b.yj(99999999,a,a.diagram===this);0<=c&&this.hb(Je,"parts",b,null,a,null,c);b.isTemporary||this.Ua();a.D(1);c=a.layerChanged;null!==c&&c(a,null,
b)}};t.yj=function(a){this.partManager.yj(a);var b=this;Sj(a,function(a){Tj(b,a)});(a instanceof Te||a instanceof Hf&&null!==a.placeholder)&&a.v();null!==a.data&&Sj(a,function(a){Uj(b.partManager,a)});!0!==Gj(a)&&!0!==Hj(a)||this.xd.add(a);Vj(a,!0,this);Wj(a)?(a.actualBounds.o()&&this.P(Qj(a,a.actualBounds)),this.Ua()):a.isVisible()&&a.actualBounds.o()&&this.P(Qj(a,a.actualBounds));this.Jb()};
t.Qc=function(a){a.xk();this.partManager.Qc(a);var b=this;null!==a.data&&Sj(a,function(a){Xj(b.partManager,a,b)});this.xd.remove(a);Wj(a)?(a.actualBounds.o()&&this.P(Qj(a,a.actualBounds)),this.Ua()):a.isVisible()&&a.actualBounds.o()&&this.P(Qj(a,a.actualBounds));this.Jb()};t.remove=function(a){x(a,S,Q,"remove:part");Yj(this,a,!0)};
function Yj(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.D(2),c&&b.Dk(),c=d.Qc(-1,b,!1),0<=c&&a.hb(Ke,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.tu=function(a,b){if(Ga(a))for(var c=a.length,d=0;d<c;d++){var e=a[d];b&&!e.canDelete()||this.remove(e)}else for(c=new I,c.addAll(a),a=c.iterator;a.next();)c=a.value,b&&!c.canDelete()||this.remove(c)};t.Ck=function(a,b,c){return this.partManager.Ck(a,b,c)};
Q.prototype.moveParts=function(a,b,c,d){void 0===d&&(d=Zj(this));x(b,J,Q,"moveParts:offset");if(null!==this.toolManager){var e=new Db;if(null!==a)if(Ga(a))for(var f=0;f<a.length;f++)ak(this,e,a[f],c,d);else for(a=a.iterator;a.next();)ak(this,e,a.value,c,d);else{for(a=this.parts;a.next();)ak(this,e,a.value,c,d);for(a=this.nodes;a.next();)ak(this,e,a.value,c,d);for(a=this.links;a.next();)ak(this,e,a.value,c,d)}Ef(this,e,b,d,c)}};
function ak(a,b,c,d,e,f){if(!b.contains(c)&&(void 0===f&&(f=!1),!d||f||c.canMove()||c.canCopy()))if(void 0===e&&(e=Zj(a)),c instanceof U){b.add(c,a.Dd(e,c,c.location));if(c instanceof Hf&&(null!==c.placeholder||e.dragsMembers))for(f=c.memberParts;f.next();)ak(a,b,f.value,d,e,e.groupsAlwaysMove);for(f=c.linksConnected;f.next();){var g=f.value;if(!b.contains(g)){var h=g.fromNode,k=g.toNode;null!==h&&b.contains(h)&&null!==k&&b.contains(k)&&ak(a,b,g,d,e)}}if(e.dragsTree)for(c=c.jw();c.next();)ak(a,b,
c.value,d,e)}else if(c instanceof R)for(b.add(c,a.Dd(e,c)),c=c.labelNodes;c.next();)ak(a,b,c.value,d,e);else c instanceof Te||b.add(c,a.Dd(e,c,c.location))}
function Ef(a,b,c,d,e){if(null!==b&&(x(b,Db,Q,"moveParts:parts"),0!==b.count)){var f=J.alloc(),g=J.alloc();g.assign(c);isNaN(g.x)&&(g.x=0);isNaN(g.y)&&(g.y=0);(c=a.qq)||jf(a,b);for(var h=La(),k=La(),l=b.iterator,m=J.alloc();l.next();){var n=l.key,p=l.value;if(n.bc()){var r=bk(a,n,b);if(null!==r)h.push(new ck(n,p,r));else if(!e||n.canMove())r=p.point,f.assign(r),a.computeMove(n,f.add(g),d,m),n.location=m,void 0===p.shifted&&(p.shifted=new J),p.shifted.assign(m.ke(r))}else l.key instanceof R&&k.push(l.qa)}J.free(m);
e=h.length;for(l=0;l<e;l++)n=h[l],f.assign(n.info.point),void 0===n.nw.shifted&&(n.nw.shifted=new J),n.node.location=f.add(n.nw.shifted);e=J.alloc();l=J.alloc();n=k.length;for(p=0;p<n;p++){var q=k[p];r=q.key;if(r instanceof R)if(r.suspendsRouting){r.Cg=null;m=r.fromNode;var u=r.toNode;if(null!==a.draggedLink&&d.dragsLink)if(u=q.value.point,null===r.dragComputation)b.add(r,a.Dd(d,r,g)),Cf(r,g.x-u.x,g.y-u.y);else{q=J.allocAt(0,0);(m=r.i(0))&&m.o()&&q.assign(m);var w=m=J.alloc().assign(q).add(g);d.isGridSnapEnabled&&
(d.isGridSnapRealtime||a.lastInput.up)&&(w=J.alloc(),Tg(a,r,m,w,d));m.assign(r.dragComputation(r,m,w)).ke(q);b.add(r,a.Dd(d,r,m));Cf(r,m.x-u.x,m.y-u.y);J.free(q);J.free(m);w!==m&&J.free(w)}else null!==m&&(e.assign(m.location),w=b.K(m),null!==w&&e.ke(w.point)),null!==u&&(l.assign(u.location),w=b.K(u),null!==w&&l.ke(w.point)),null!==m&&null!==u?e.Ta(l)?(m=q.value.point,u=f,u.assign(e),u.ke(m),b.add(r,a.Dd(d,r,e)),Cf(r,u.x,u.y)):(r.suspendsRouting=!1,r.Za()):(q=q.value.point,m=null!==m?e:null!==u?l:
g,b.add(r,a.Dd(d,r,m)),Cf(r,m.x-q.x,m.y-q.y))}else if(null===r.fromNode||null===r.toNode)m=q.value.point,b.add(r,a.Dd(d,r,g)),Cf(r,g.x-m.x,g.y-m.y)}J.free(f);J.free(g);J.free(e);J.free(l);Oa(h);Oa(k);c||(gj(a),of(a,b))}}
Q.prototype.computeMove=function(a,b,c,d){void 0===d&&(d=new J);d.assign(b);if(null===a)return d;var e=b,f=c.isGridSnapEnabled;f&&(c.isGridSnapRealtime||this.lastInput.up)&&(e=J.alloc(),Tg(this,a,b,e,c));c=null!==a.dragComputation?a.dragComputation(a,b,e):e;var g=a.minLocation,h=g.x;isNaN(h)&&(h=f?Math.round(1E3*a.location.x)/1E3:a.location.x);g=g.y;isNaN(g)&&(g=f?Math.round(1E3*a.location.y)/1E3:a.location.y);var k=a.maxLocation,l=k.x;isNaN(l)&&(l=f?Math.round(1E3*a.location.x)/1E3:a.location.x);
k=k.y;isNaN(k)&&(k=f?Math.round(1E3*a.location.y)/1E3:a.location.y);d.h(Math.max(h,Math.min(c.x,l)),Math.max(g,Math.min(c.y,k)));e!==b&&J.free(e);return d};function Zj(a){var b=a.toolManager.findTool("Dragging");return null!==b?b.dragOptions:a.pl}
function Tg(a,b,c,d,e){void 0===e&&(e=Zj(a));d.assign(c);if(null!==b){var f=a.grid;b=e.gridSnapCellSize;a=b.width;b=b.height;var g=e.gridSnapOrigin,h=g.x;g=g.y;e=e.gridSnapCellSpot;if(null!==f){var k=f.gridCellSize;isNaN(a)&&(a=k.width);isNaN(b)&&(b=k.height);f=f.gridOrigin;isNaN(h)&&(h=f.x);isNaN(g)&&(g=f.y)}f=J.allocAt(0,0);f.Wk(0,0,a,b,e);K.Rq(c.x,c.y,h+f.x,g+f.y,a,b,d);J.free(f)}}function jf(a,b){if(null!==b)for(a.qq=!0,a=b.iterator;a.next();)b=a.key,b instanceof R&&(b.suspendsRouting=!0)}
function of(a,b){if(null!==b){for(b=b.iterator;b.next();){var c=b.key;c instanceof R&&(c.suspendsRouting=!1,dk(c)&&c.Za())}a.qq=!1}}function bk(a,b,c){b=b.containingGroup;if(null!==b){a=bk(a,b,c);if(null!==a)return a;a=c.K(b);if(null!==a)return a}return null}t=Q.prototype;t.Dd=function(a,b,c){if(void 0===c)return new mf(Ob);var d=a.isGridSnapEnabled;a.groupsSnapMembers||null===b.containingGroup||(d=!1);return d?new mf(new J(Math.round(1E3*c.x)/1E3,Math.round(1E3*c.y)/1E3)):new mf(c.copy())};
function ek(a,b,c){x(b,wi,Q,"addLayer:layer");null!==b.diagram&&b.diagram!==a&&v("Cannot share a Layer with another Diagram: "+b+" of "+b.diagram);null===c?null!==b.diagram&&v("Cannot add an existing Layer to this Diagram again: "+b):(x(c,wi,Q,"addLayer:existingLayer"),c.diagram!==a&&v("Existing Layer must be in this Diagram: "+c+" not in "+c.diagram),b===c&&v("Cannot move a Layer before or after itself: "+b));if(b.diagram!==a){b=b.name;a=a.Qa;c=a.count;for(var d=0;d<c;d++)a.O(d).name===b&&v("Cannot add Layer with the name '"+
b+"'; a Layer with the same name is already present in this Diagram.")}}t.Bm=function(a){ek(this,a,null);a.ie(this);var b=this.Qa,c=b.count-1;if(!a.isTemporary)for(;0<=c&&b.O(c).isTemporary;)c--;b.Ab(c+1,a);null!==this.gc&&this.hb(Je,"layers",this,null,a,null,c+1);this.P();this.Ua()};
t.iy=function(a,b){ek(this,a,b);a.ie(this);var c=this.Qa,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.gc&&this.hb(Ke,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.O(f)===b){c.Ab(f,a);break}null!==this.gc&&this.hb(Je,"layers",this,null,a,null,f);this.P();0>d&&this.Ua()};
t.Az=function(a,b){ek(this,a,b);a.ie(this);var c=this.Qa,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.gc&&this.hb(Ke,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.O(f)===b){c.Ab(f+1,a);break}null!==this.gc&&this.hb(Je,"layers",this,null,a,null,f+1);this.P();0>d&&this.Ua()};
t.gB=function(a){x(a,wi,Q,"removeLayer:layer");a.diagram!==this&&v("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.Qa,c=b.indexOf(a);if(b.remove(a)){for(b=a.Ia.copy().iterator;b.next();){var d=b.value,e=d.layerName;e!==a.name?d.layerName=e:d.layerName=""}null!==this.gc&&this.hb(Ke,"layers",this,a,null,c,null);this.P();this.Ua()}}};t.Hm=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null};
t.ly=function(a){A(a,"function",Q,"addModelChangedListener:listener");null===this.De&&(this.De=new H);this.De.add(a);this.model.Sh(a)};t.iB=function(a){A(a,"function",Q,"removeModelChangedListener:listener");null!==this.De&&(this.De.remove(a),0===this.De.count&&(this.De=null));this.model.Vk(a)};t.Sh=function(a){A(a,"function",Q,"addChangedListener:listener");null===this.Zf&&(this.Zf=new H);this.Zf.add(a)};
t.Vk=function(a){A(a,"function",Q,"removeChangedListener:listener");null!==this.Zf&&(this.Zf.remove(a),0===this.Zf.count&&(this.Zf=null))};t.Mt=function(a){this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.ow(a);a.change!==Ie&&(this.isModified=!0);if(null!==this.Zf)for(var b=this.Zf,c=b.length,d=0;d<c;d++)b.O(d)(a)};
t.hb=function(a,b,c,d,e,f,g){void 0===f&&(f=null);void 0===g&&(g=null);var h=new Ge;h.diagram=this;h.change=a;h.propertyName=b;h.object=c;h.oldValue=d;h.oldParam=f;h.newValue=e;h.newParam=g;this.Mt(h)};t.g=function(a,b,c,d,e){this.hb(He,a,this,b,c,d,e)};
Q.prototype.changeState=function(a,b){if(null!==a&&a.diagram===this){var c=this.skipsModelSourceBindings;try{this.skipsModelSourceBindings=!0;var d=a.change;if(d===He){var e=a.object;fk(e,a.propertyName,a.K(b));if(e instanceof N){var f=e.part;null!==f&&f.Rb()}this.isModified=!0}else if(d===Je){var g=a.object,h=a.newParam,k=a.newValue;if(g instanceof V)if("number"===typeof h&&k instanceof N){b?g.Qc(h):g.Ab(h,k);var l=g.part;null!==l&&l.Rb()}else{if("number"===typeof h&&k instanceof gk)if(b)k.isRow?
g.Hw(h):g.Fw(h);else{var m=k.isRow?g.getRowDefinition(k.index):g.getColumnDefinition(k.index);m.Qt(k)}}else if(g instanceof wi){var n=!0===a.oldParam;"number"===typeof h&&k instanceof S&&(b?(k.isSelected=!1,k.isHighlighted=!1,k.Rb(),g.Qc(n?h:-1,k,n)):g.yj(h,k,n))}else g instanceof Q?"number"===typeof h&&k instanceof wi&&(b?this.Qa.ib(h):(k.ie(this),this.Qa.Ab(h,k))):v("unknown ChangedEvent.Insert object: "+a.toString());this.isModified=!0}else if(d===Ke){var p=a.object,r=a.oldParam,q=a.oldValue;if(p instanceof
V)"number"===typeof r&&q instanceof N?b?p.Ab(r,q):p.Qc(r):"number"===typeof r&&q instanceof gk&&(b?(m=q.isRow?p.getRowDefinition(q.index):p.getColumnDefinition(q.index),m.Qt(q)):q.isRow?p.Hw(r):p.Fw(r));else if(p instanceof wi){var u=!0===a.newParam;"number"===typeof r&&q instanceof S&&(b?0>p.Ia.indexOf(q)&&p.yj(r,q,u):(q.isSelected=!1,q.isHighlighted=!1,q.Rb(),p.Qc(u?r:-1,q,u)))}else p instanceof Q?"number"===typeof r&&q instanceof wi&&(b?(q.ie(this),this.Qa.Ab(r,q)):this.Qa.ib(r)):v("unknown ChangedEvent.Remove object: "+
a.toString());this.isModified=!0}else d!==Ie&&v("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=c}}};Q.prototype.Ca=function(a){return this.undoManager.Ca(a)};Q.prototype.bb=function(a){return this.undoManager.bb(a)};Q.prototype.Tf=function(){return this.undoManager.Tf()};
Q.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Ca(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.bb(b):this.undoManager.Tf(),this.skipsUndoManager=c}};Q.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};Q.prototype.zr=function(){this.partManager.zr()};
function hk(a,b,c){var d=a.animationManager;if(a.Xb||a.pc)a.Fa=c,d.rf&&d.Pd.add(d.B,"scale",b,a.Fa);else if(null===a.Aa)a.Fa=c;else{a.Xb=!0;var e=a.viewportBounds.copy(),f=a.Ea,g=a.Da;e.width=a.Ea/b;e.height=a.Da/b;var h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.Sc()?l.Pf(Uc)?h=0:l.Pf(Vc)&&(h=f-1):h=l.cb()?l.x*(f-1):f/2);isNaN(k)&&(l.Sc()?l.Pf(Tc)?k=0:l.Pf(Wc)&&(k=g-1):k=l.cb()?l.y*(g-1):g/2);null===a.scaleComputation||a.animationManager.isAnimating||(c=a.scaleComputation(a,
c));c<a.minScale&&(c=a.minScale);c>a.maxScale&&(c=a.maxScale);f=J.allocAt(a.ra.x+h/b-h/c,a.ra.y+k/b-k/c);a.position=f;J.free(f);a.Fa=c;a.ir(e,a.viewportBounds,b,!1);a.Xb=!1;ij(a,!1);d.rf&&d.Pd.add(d.B,"scale",b,a.Fa);a.P();lj(a)}}
Q.prototype.ir=function(a,b,c,d){if(!a.A(b)){void 0===d&&(d=!1);d||lj(this);fj(this);var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==Wh||d||a.width===b.width&&a.height===b.height||e.D();e=this.currentTool;!0===this.kg&&e instanceof Ta&&(this.lastInput.documentPoint=this.Au(this.lastInput.viewPoint),af(e,this));this.Xb||this.Ry(a,b);Bj(this);this.ce.scale=c;this.ce.position.x=a.x;this.ce.position.y=a.y;this.ce.bounds.assign(a);this.ce.uw=d;this.U("ViewportBoundsChanged",this.ce,a);
this.isVirtualized&&this.links.each(function(a){a.isAvoiding&&a.actualBounds.Rc(b)&&a.Za()})}};
function Bj(a,b){void 0===b&&(b=null);var c=a.Ob;if(null!==c&&c.visible){for(var d=Hb.alloc(),e=1,f=1,g=c.$.j,h=g.length,k=0;k<h;k++){var l=g[k],m=l.interval;2>m||(ik(l.figure)?f=f*m/K.Gy(f,m):e=e*m/K.Gy(e,m))}g=c.gridCellSize;d.h(f*g.width,e*g.height);if(null!==b)e=b.width,f=b.height,a=b.x,g=b.y;else{b=L.alloc();a=a.viewportBounds;b.h(a.x,a.y,a.width,a.height);if(!b.o()){L.free(b);return}e=b.width;f=b.height;a=b.x;g=b.y;L.free(b)}c.width=e+2*d.width;c.height=f+2*d.height;b=J.alloc();K.Rq(a,g,0,0,
d.width,d.height,b);b.offset(-d.width,-d.height);Hb.free(d);c.part.location=b;J.free(b)}}Q.prototype.clearSelection=function(a){void 0===a&&(a=!1);var b=this.selection;if(0!==b.count){a||this.U("ChangingSelection",b);for(var c=b.ta(),d=c.length,e=0;e<d;e++)c[e].isSelected=!1;b.ka();b.clear();b.freeze();a||this.U("ChangedSelection",b)}};
Q.prototype.select=function(a){null!==a&&(x(a,S,Q,"select:part"),a.layer.diagram===this&&(!a.isSelected||1<this.selection.count)&&(this.U("ChangingSelection",this.selection),this.clearSelection(!0),a.isSelected=!0,this.U("ChangedSelection",this.selection)))};
Q.prototype.mB=function(a){this.U("ChangingSelection",this.selection);this.clearSelection(!0);if(Ga(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof S||v("Diagram.selectCollection given something that is not a Part: "+d);d.isSelected=!0}else for(a=a.iterator;a.next();)b=a.value,b instanceof S||v("Diagram.selectCollection given something that is not a Part: "+b),b.isSelected=!0;this.U("ChangedSelection",this.selection)};
Q.prototype.clearHighlighteds=function(){var a=this.highlighteds;if(0<a.count){for(var b=a.ta(),c=b.length,d=0;d<c;d++)b[d].isHighlighted=!1;a.ka();a.clear();a.freeze()}};t=Q.prototype;t.JA=function(a){null!==a&&a.layer.diagram===this&&(x(a,S,Q,"highlight:part"),!a.isHighlighted||1<this.highlighteds.count)&&(this.clearHighlighteds(),a.isHighlighted=!0)};
t.KA=function(a){a=(new I).addAll(a);for(var b=this.highlighteds.copy().nr(a).iterator;b.next();)b.value.isHighlighted=!1;for(a=a.iterator;a.next();)b=a.value,b instanceof S||v("Diagram.highlightCollection given something that is not a Part: "+b),b.isHighlighted=!0};
t.scroll=function(a,b,c){void 0===c&&(c=1);var d="up"===b||"down"===b,e=0;if("pixel"===a)e=c;else if("line"===a)e=c*(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange);else if("page"===a)a=d?this.viewportBounds.height:this.viewportBounds.width,a*=this.scale,0!==a&&(e=c*Math.max(a-(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange),0));else{if("document"===a){e=this.documentBounds;c=this.viewportBounds;d=J.alloc();"up"===b?this.position=d.h(c.x,e.y):"left"===b?this.position=
d.h(e.x,c.y):"down"===b?this.position=d.h(c.x,e.bottom-c.height):"right"===b&&(this.position=d.h(e.right-c.width,c.y));J.free(d);return}v("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+a)}e/=this.scale;c=this.position.copy();"up"===b?c.y=this.position.y-e:"down"===b?c.y=this.position.y+e:"left"===b?c.x=this.position.x-e:"right"===b?c.x=this.position.x+e:v("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+b);this.position=c};
t.Nw=function(a){var b=this.viewportBounds;b.Qe(a)||(a=a.center,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};t.Nt=function(a){var b=this.viewportBounds;a=a.center;a.x-=b.width/2;a.y-=b.height/2;this.position=a};t.xr=function(a){var b=this.tb;b.reset();1!==this.Fa&&b.scale(this.Fa);var c=this.ra;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.tb)};
t.vB=function(a){var b=this.tb,c=a.x,d=a.y,e=c+a.width,f=d+a.height,g=b.m11,h=b.m12,k=b.m21,l=b.m22,m=b.dx,n=b.dy,p=c*g+d*k+m;b=c*h+d*l+n;var r=e*g+d*k+m;a=e*h+d*l+n;d=c*g+f*k+m;c=c*h+f*l+n;g=e*g+f*k+m;e=e*h+f*l+n;f=Math.min(p,r);p=Math.max(p,r);r=Math.min(b,a);b=Math.max(b,a);f=Math.min(f,d);p=Math.max(p,d);r=Math.min(r,c);b=Math.max(b,c);f=Math.min(f,g);p=Math.max(p,g);r=Math.min(r,e);b=Math.max(b,e);return new L(f,r,p-f,b-r)};
t.Au=function(a){var b=this.tb;b.reset();1!==this.Fa&&b.scale(this.Fa);var c=this.ra;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return Jb(a.copy(),this.tb)};function jk(a){var b=a.isModified;a.Mv!==b&&(a.Mv=b,a.U("Modified"))}function kk(a){a=Gi.get(a);return null!==a?new a:new Hi}
Q.prototype.doModelChanged=function(a){var b=this;if(a.model===this.model){var c=a.change,d=a.propertyName;if(c===Ie&&"S"===d[0])if("StartingFirstTransaction"===d){var e=this;a=this.toolManager;a.mouseDownTools.each(function(a){a.diagram=e});a.mouseMoveTools.each(function(a){a.diagram=e});a.mouseUpTools.each(function(a){a.diagram=e});this.pc||this.we||(this.Qj=!0,this.Tj&&(this.Ne=!0))}else"StartingUndo"===d||"StartingRedo"===d?(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&
a.Tc(),this.U("ChangingSelection",this.selection)):"StartedTransaction"===d&&(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&a.Tc());else if(this.ba){this.ba=!1;try{if(""===a.modelChange&&c===Ie){if("FinishedUndo"===d||"FinishedRedo"===d)this.U("ChangedSelection",this.selection),gj(this);var f=this.animationManager;"RolledBackTransaction"===d&&f.Tc();this.Qj=!0;this.jd();0!==this.undoManager.transactionLevel&&1!==this.undoManager.transactionLevel||Gh(f);"CommittedTransaction"===
d&&this.undoManager.isJustDiscarded&&(this.Vd=Math.min(this.Vd,this.undoManager.historyIndex-1));"CommittedTransaction"!==d&&"RolledBackTransaction"!==d||!this.undoManager.isPendingUnmodified||setTimeout(function(){b.isModified=!1},1);var g=a.isTransactionFinished;g&&(jk(this),this.ju.clear(),di(this.animationManager));if(!this.Qs&&g&&this.lastInput.targetDiagram){this.Qs=!0;var h=this;ta(function(){h.currentTool.standardMouseOver();h.Qs=!1},10)}}}finally{this.ba=!0}}}};
function Tj(a,b){b=b.$.j;for(var c=b.length,d=0;d<c;d++)lk(a,b[d])}function lk(a,b){if(b instanceof mk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){var d=b.kh;null!==d&&(d.Bl instanceof Event&&null!==b.Ic&&b.Ic(b,d.Bl),!0===d.As&&(null!==b.Cf&&b.Cf(b,d.Bv),null!==b.diagram&&b.diagram.$s.add(b)));c=c.getAttribute("src");d=a.$i.K(c);if(null===d)d=[],d.push(b),a.$i.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}}
function nk(a,b){if(b instanceof mk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){c=c.getAttribute("src");var d=a.$i.K(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&(a.$i.remove(c),ok(c));break}}}}Q.prototype.Ld=function(){this.partManager.Ld()};Q.prototype.tk=function(a,b){this.Xc.tk(a,b)};Q.prototype.vk=function(a,b){this.Xc.vk(a,b)};Q.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)};Q.prototype.Hb=function(a){return this.partManager.Hb(a)};
Q.prototype.findLinkForKey=function(a){return this.partManager.findLinkForKey(a)};t=Q.prototype;t.Ec=function(a){return this.partManager.Ec(a)};t.rj=function(a){return this.partManager.rj(a)};t.Dc=function(a){return this.partManager.Dc(a)};t.Wt=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Wt.apply(this.partManager,b instanceof Array?b:da(ca(b)))};
t.Vt=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Vt.apply(this.partManager,b instanceof Array?b:da(ca(b)))};function Oj(a,b){a.Fi=!1;var c=a.co;c.A(b)||(b=b.J(),a.co=b,ij(a,!1),a.U("DocumentBoundsChanged",null,c.copy()),lj(a))}t.Ya=function(){this.Fi&&Oj(this,this.computeBounds())};t.sA=function(){for(var a=new I,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&a.add(c)}for(b=this.links;b.next();)c=b.value,c.isTopLevel&&a.add(c);return a.iterator};
t.rA=function(){return this.Oh.iterator};t.UA=function(a){gj(this);a&&pk(this,!0);this.Qj=!0;Qf(this)};function pk(a,b){for(var c=a.Oh.iterator;c.next();)zk(a,c.value,b);null!==a.layout&&(b?a.layout.isValidLayout=!1:a.layout.D())}function zk(a,b,c){if(null!==b){for(var d=b.Zl.iterator;d.next();)zk(a,d.value,c);null!==b.layout&&(c?b.layout.isValidLayout=!1:b.layout.D())}}
function Cj(a,b){if(a.Zg&&!a.ds){var c=a.ba;a.ba=!0;var d=a.undoManager.transactionLevel,e=a.layout,f=a.animationManager;try{0===d&&(a.undoManager.isInternalTransaction=!0,a.Ca("Layout"));1>=d&&!f.isAnimating&&!f.xc&&(b||Eh(f,"Layout"));a.Zg=!1;for(var g=a.Oh.iterator;g.next();)Dk(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),gj(a),e.isValidLayout=!0):a.Zg=!0)}finally{b=a.undoManager.isInternalTransaction,0===d&&(a.bb("Layout"),a.undoManager.isInternalTransaction=
!1),!b||0!==d&&1!==d||Gh(f),a.ba=c}}}function Dk(a,b,c,d){if(null!==b){for(var e=b.Zl.iterator;e.next();)Dk(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.bi=!b.location.o(),e.doLayout(b),b.D(32),Ej(a,b),e.isValidLayout=!0):a.Zg=!0)}}t.yA=function(){for(var a=new H,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.uj()&&a.add(c)}return a.iterator};
function Ei(a){function b(a){var b=a.toLowerCase(),e=new H;c.add(a,e);c.add(b,e);d.add(a,a);d.add(b,a)}var c=new Db,d=new Db;b("InitialAnimationStarting");b("AnimationStarting");b("AnimationFinished");b("BackgroundSingleClicked");b("BackgroundDoubleClicked");b("BackgroundContextClicked");b("ClipboardChanged");b("ClipboardPasted");b("DocumentBoundsChanged");b("ExternalObjectsDropped");b("GainedFocus");b("InitialLayoutCompleted");b("LayoutCompleted");b("LinkDrawn");b("LinkRelinked");b("LinkReshaped");
b("LostFocus");b("Modified");b("ObjectSingleClicked");b("ObjectDoubleClicked");b("ObjectContextClicked");b("PartCreated");b("PartResized");b("PartRotated");b("SelectionMoved");b("SelectionCopied");b("SelectionDeleting");b("SelectionDeleted");b("SelectionGrouped");b("SelectionUngrouped");b("ChangingSelection");b("ChangedSelection");b("SubGraphCollapsed");b("SubGraphExpanded");b("TextEdited");b("TreeCollapsed");b("TreeExpanded");b("ViewportBoundsChanged");b("InvalidateDraw");a.gs=c;a.fs=d}
function Nj(a,b){var c=a.fs.K(b);return null!==c?c:a.fs.K(b.toLowerCase())}function Ek(a,b){var c=a.gs.K(b);if(null!==c)return c;c=a.gs.K(b.toLowerCase());if(null!==c)return c;v("Unknown DiagramEvent name: "+b)}t.uk=function(a,b){A(a,"string",Q,"addDiagramListener:name");A(b,"function",Q,"addDiagramListener:listener");a=Ek(this,a);null!==a&&a.add(b)};t.Ym=function(a,b){A(a,"string",Q,"removeDiagramListener:name");A(b,"function",Q,"addDiagramListener:listener");a=Ek(this,a);null!==a&&a.remove(b)};
t.U=function(a,b,c){F&&A(a,"string",Q,"raiseDiagramEvent:name");var d=Ek(this,a),e=new ye;e.diagram=this;a=Nj(this,a);null!==a&&(e.name=a);void 0!==b&&(e.subject=b);void 0!==c&&(e.parameter=c);b=d.length;if(1===b)d.O(0)(e);else if(0!==b)for(d=d.ta(),c=0;c<b;c++)(0,d[c])(e)};function Fk(a){if(a.animationManager.isTicking)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.qq||b.isComplexRoutingRealtime:!0}
t.Kk=function(a,b){void 0===b&&(b=null);return Gk(this,!1,null,b).Kk(a.x,a.y,a.width,a.height)};Q.prototype.computeOccupiedArea=function(){return this.isVirtualized?this.viewportBounds.copy():this.Fi?hj(this):this.documentBounds.copy()};
function Gk(a,b,c,d){null===a.Mc&&(a.Mc=new Hk);if(a.Mc.du||a.Mc.group!==c||a.Mc.hz!==d){if(null===c){b=a.computeOccupiedArea();b.Oc(100,100);a.Mc.initialize(b);b=L.alloc();for(var e=a.nodes;e.next();){var f=e.value,g=f.layer;null!==g&&g.visible&&!g.isTemporary&&Ik(a,f,d,b)}L.free(b)}else{0<c.memberParts.count&&(b=a.computePartsBounds(c.memberParts,!1),b.Oc(20,20),a.Mc.initialize(b));b=L.alloc();for(e=c.memberParts;e.next();)f=e.value,f instanceof U&&Ik(a,f,d,b);L.free(b)}a.Mc.group=c;a.Mc.hz=d;a.Mc.du=
!1}else b&&Jk(a.Mc);return a.Mc}function Ik(a,b,c,d){if(b!==c)if(b.isVisible()&&b.avoidable&&!b.isLinkLabel){b=b.getAvoidableRect(d);a=a.Mc;var e=b.x,f=b.y;if(Kk(a,e,f))for(c=(f-a.Cd)/a.lc|0,d=Math.min((e+b.width-a.Bd)/a.kc|0,a.jj),b=Math.min((f+b.height-a.Cd)/a.lc|0,a.kj),e=(e-a.Bd)/a.kc|0;e<=d;e++)if(f=a.Wb[e],f.fill)f.fill(Lk,c,b+1);else for(var g=c;g<=b;g++)f[g]=Lk}else if(b instanceof Hf)for(b=b.memberParts;b.next();)e=b.value,e instanceof U&&Ik(a,e,c,d)}
function Mk(a,b){null!==a.Mc&&!a.Mc.du&&(void 0===b&&(b=null),null===b||b.avoidable&&!b.isLinkLabel)&&(a.Mc.du=!0)}Q.prototype.St=function(a){this.Dn.assign(a);this.computeAutoScrollPosition(this.Dn).Ta(this.position)?this.Uf():Nk(this)};
function Nk(a){-1===a.Kj&&(a.Kj=ta(function(){if(-1!==a.Kj&&(a.Uf(),null!==a.lastInput.event)){var b=a.computeAutoScrollPosition(a.Dn);b.Ta(a.position)||(a.position=b,a.lastInput.documentPoint=a.Au(a.Dn),a.doMouseMove(),a.Fi=!0,Oj(a,a.documentBounds.copy().Uc(a.computeBounds())),a.Jc=!0,a.jd(),Nk(a))}},a.Cn))}Q.prototype.Uf=function(){-1!==this.Kj&&(qa.clearTimeout(this.Kj),this.Kj=-1)};
Q.prototype.computeAutoScrollPosition=function(a){var b=this.position,c=this.En;if(0>=c.top&&0>=c.left&&0>=c.right&&0>=c.bottom)return b;var d=this.viewportBounds,e=this.scale;d=L.allocAt(0,0,d.width*e,d.height*e);var f=J.allocAt(0,0);if(a.x>=d.x&&a.x<d.x+c.left&&this.allowHorizontalScroll){var g=Math.max(this.scrollHorizontalLineChange,1);g|=0;f.x-=g;a.x<d.x+c.left/2&&(f.x-=g);a.x<d.x+c.left/4&&(f.x-=4*g)}else a.x<=d.x+d.width&&a.x>d.x+d.width-c.right&&this.allowHorizontalScroll&&(g=Math.max(this.scrollHorizontalLineChange,
1),g|=0,f.x+=g,a.x>d.x+d.width-c.right/2&&(f.x+=g),a.x>d.x+d.width-c.right/4&&(f.x+=4*g));a.y>=d.y&&a.y<d.y+c.top&&this.allowVerticalScroll?(g=Math.max(this.scrollVerticalLineChange,1),g|=0,f.y-=g,a.y<d.y+c.top/2&&(f.y-=g),a.y<d.y+c.top/4&&(f.y-=4*g)):a.y<=d.y+d.height&&a.y>d.y+d.height-c.bottom&&this.allowVerticalScroll&&(g=Math.max(this.scrollVerticalLineChange,1),g|=0,f.y+=g,a.y>d.y+d.height-c.bottom/2&&(f.y+=g),a.y>d.y+d.height-c.bottom/4&&(f.y+=4*g));f.Ta(Ob)||(b=new J(b.x+f.x/e,b.y+f.y/e));
L.free(d);J.free(f);return b};t=Q.prototype;t.lu=function(){return null};t.vw=function(){return null};t.Dz=function(a,b){this.Wx.add(a,b)};
function Ok(a,b,c){function d(){var a=+new Date;f=!0;for(g.reset();g.next();)if(!g.value[0].Vl){f=!1;break}f||a-l>k?b(c,e,h):qa.requestAnimationFrame(d)}for(var e=c.callback,f=!0,g=a.$i.iterator;g.next();)if(!g.value[0].Vl){f=!1;break}if("function"!==typeof e||f)return b(c,e,a);var h=a,k=c.callbackTimeout||300,l=+new Date;qa.requestAnimationFrame(function(){d()});return null}t.WA=function(a){if(!gh)return null;void 0===a&&(a=new jb);a.returnType="Image";return this.Uy(a)};
t.Uy=function(a){void 0===a&&(a=new jb);return Ok(this,this.XA,a)};
t.XA=function(a,b,c){var d=Pk(c,a,"canvas",null);if(null===d)return null;c=d.aa.canvas;var e=null;if(null!==c)switch(e=a.returnType,void 0===e?e="string":e=e.toLowerCase(),e){case "imagedata":e=d.getImageData(0,0,c.width,c.height);break;case "image":d=(a.document||document).createElement("img");d.src=c.toDataURL(a.type,a.details);e=d;break;case "blob":"function"!==typeof b&&v('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.');if("function"===
typeof c.toBlob)return c.toBlob(b,a.type,a.details),"toBlob";if("function"===typeof c.msToBlob)return b(c.msToBlob()),"msToBlob";b(null);return null;default:e=c.toDataURL(a.type,a.details)}return"function"===typeof b?(b(e),null):e};
function Pk(a,b,c,d){a.animationManager.Tc();a.jd();if(null===a.Aa)return null;"object"!==typeof b&&v("properties argument must be an Object.");var e=!1,f=b.size||null,g=b.scale||null;void 0!==b.scale&&isNaN(b.scale)&&(g="NaN");var h=b.maxSize;void 0===b.maxSize&&(e=!0,h="SVG"===c?new Hb(Infinity,Infinity):new Hb(2E3,2E3));var k=b.position||null,l=b.parts||null,m=void 0===b.padding?1:b.padding,n=b.background||null,p=b.omitTemporary;void 0===p&&(p=!0);var r=b.document||document,q=b.elementFinished||
null,u=b.showTemporary;void 0===u&&(u=!p);b=b.showGrid;void 0===b&&(b=u);null!==f&&isNaN(f.width)&&isNaN(f.height)&&(f=null);"number"===typeof m?m=new lc(m):m instanceof lc||v("MakeImage padding must be a Margin or a number.");m.left=Math.max(m.left,0);m.right=Math.max(m.right,0);m.top=Math.max(m.top,0);m.bottom=Math.max(m.bottom,0);a.Mb.zc(!0);p=new Qk(null,r);var w=p.context;if(!(f||g||l||k)){p.width=a.Ea+Math.ceil(m.left+m.right);p.height=a.Da+Math.ceil(m.top+m.bottom);if("SVG"===c){if(null===
d)return null;d.resize(p.width,p.height,p.width,p.height);d.ownerDocument=r;d.Oq=q;Lj(a,d.context,m,new Hb(p.width,p.height),a.Fa,a.ra,l,n,u,b);return d.context}a.wl=!1;Lj(a,w,m,new Hb(p.width,p.height),a.Fa,a.ra,l,n,u,b);a.wl=!0;return p.context}var y=a.bo,z=a.documentBounds.copy();z.Ww(a.mb);if(u)for(var B=a.Qa.j,D=B.length,G=0;G<D;G++){var O=B[G];if(O.visible&&O.isTemporary){O=O.Ia.j;for(var T=O.length,P=0;P<T;P++){var ba=O[P];ba.isInDocumentBounds&&ba.isVisible()&&(ba=ba.actualBounds,ba.o()&&
z.Uc(ba))}}}B=new J(z.x,z.y);if(null!==l){D=!0;G=l.iterator;for(G.reset();G.next();)if(O=G.value,O instanceof S&&(T=O.layer,(null===T||T.visible)&&(null===T||u||!T.isTemporary)&&O.isVisible()&&(O=O.actualBounds,O.o())))if(D){D=!1;var Y=O.copy()}else Y.Uc(O);D&&(Y=new L(0,0,0,0));z.width=Y.width;z.height=Y.height;B.x=Y.x;B.y=Y.y}null!==k&&k.o()&&(B=k,g||(g=y));Y=k=0;null!==m&&(k=m.left+m.right,Y=m.top+m.bottom);D=G=0;null!==f&&(G=f.width,D=f.height,isFinite(G)&&(G=Math.max(0,G-k)),isFinite(D)&&(D=
Math.max(0,D-Y)));null!==f&&null!==g?("NaN"===g&&(g=y),f.o()?(f=G,z=D):isNaN(D)?(f=G,z=z.height*g):(f=z.width*g,z=D)):null!==f?f.o()?(g=Math.min(G/z.width,D/z.height),f=G,z=D):isNaN(D)?(g=G/z.width,f=G,z=z.height*g):(g=D/z.height,f=z.width*g,z=D):null!==g?"NaN"===g&&h.o()?(g=Math.min((h.width-k)/z.width,(h.height-Y)/z.height),g>y?(g=y,f=z.width,z=z.height):(f=h.width,z=h.height)):(f=z.width*g,z=z.height*g):(g=y,f=z.width,z=z.height);null!==m?(f+=k,z+=Y):m=new lc(0);null!==h&&(y=h.width,h=h.height,
"SVG"!==c&&e&&!Rk&&F&&(f>y||z>h)&&(Ca("Diagram.makeImage(data): Diagram width or height is larger than the default max size. ("+Math.ceil(f)+"x"+Math.ceil(z)+" vs 2000x2000) Consider increasing the max size."),Rk=!0),isNaN(y)&&(y=2E3),isNaN(h)&&(h=2E3),isFinite(y)&&(f=Math.min(f,y)),isFinite(h)&&(z=Math.min(z,h)));p.width=Math.ceil(f);p.height=Math.ceil(z);if("SVG"===c){if(null===d)return null;d.resize(p.width,p.height,p.width,p.height);d.ownerDocument=r;d.Oq=q;Lj(a,d.context,m,new Hb(Math.ceil(f),
Math.ceil(z)),g,B,l,n,u,b);return d.context}a.wl=!1;Lj(a,w,m,new Hb(Math.ceil(f),Math.ceil(z)),g,B,l,n,u,b);a.wl=!0;return p.context}
ma.Object.defineProperties(Q.prototype,{div:{configurable:!0,get:function(){return this.Ja},set:function(a){null!==a&&x(a,HTMLDivElement,Q,"div");if(this.Ja!==a){Xa=[];var b=this.Ja;null!==b?(b.B=void 0,b.goDiagram=void 0,b.innerHTML="",null!==this.Aa&&(b=this.Aa.La,this.removeEventListener(b,"touchstart",this.ax,!1),this.removeEventListener(b,"touchmove",this.$w,!1),this.removeEventListener(b,"touchend",this.Zw,!1),this.Aa.wy()),this.em&&(this.em.disconnect(),this.em=null),b=this.toolManager,
null!==b&&(b.mouseDownTools.each(function(a){a.cancelWaitAfter()}),b.mouseMoveTools.each(function(a){a.cancelWaitAfter()}),b.mouseUpTools.each(function(a){a.cancelWaitAfter()})),b.cancelWaitAfter(),this.currentTool.doCancel(),this.Mb=this.Aa=null,this.removeEventListener(qa,"resize",this.kx,!1),this.removeEventListener(qa,"mousemove",this.Ok,!0),this.removeEventListener(qa,"mousedown",this.Nk,!0),this.removeEventListener(qa,"mouseup",this.Qk,!0),this.removeEventListener(qa,"wheel",this.Rk,!0),this.removeEventListener(qa,
"mouseout",this.Pk,!0),Pe===this&&(Pe=null)):this.we=!1;this.Ja=null;if(null!==a){if(b=a.B)b.div=null;Oi(this,a);this.We()}}}},ny:{configurable:!0,get:function(){return this.mp}},Aj:{configurable:!0,get:function(){return this.we}},draggedLink:{configurable:!0,get:function(){return this.js},set:function(a){this.js!==a&&(this.js=a,null!==a&&(this.Us=a.fromPort,this.Vs=a.toPort))}},Xy:{configurable:!0,get:function(){return this.Us},set:function(a){this.Us=
a}},Yy:{configurable:!0,get:function(){return this.Vs},set:function(a){this.Vs=a}},animationManager:{configurable:!0,get:function(){return this.Xc}},undoManager:{configurable:!0,get:function(){return this.gc.undoManager}},skipsUndoManager:{configurable:!0,get:function(){return this.Gg},set:function(a){A(a,"boolean",Q,"skipsUndoManager");this.Gg=a;this.gc.skipsUndoManager=a}},delaysLayout:{configurable:!0,get:function(){return this.ds},
set:function(a){this.ds=a}},opacity:{configurable:!0,get:function(){return this.yb},set:function(a){var b=this.yb;b!==a&&(A(a,"number",Q,"opacity"),(0>a||1<a)&&ya(a,"0 <= value <= 1",Q,"opacity"),this.yb=a,this.g("opacity",b,a),this.P())}},validCycle:{configurable:!0,get:function(){return this.Gt},set:function(a){var b=this.Gt;b!==a&&(hb(a,Q,Q,"validCycle"),this.Gt=a,this.g("validCycle",b,a))}},layers:{configurable:!0,get:function(){return this.Qa.iterator}},
isModelReadOnly:{configurable:!0,get:function(){var a=this.gc;return null===a?!1:a.isReadOnly},set:function(a){var b=this.gc;null!==b&&(b.isReadOnly=a)}},isReadOnly:{configurable:!0,get:function(){return this.lg},set:function(a){var b=this.lg;b!==a&&(A(a,"boolean",Q,"isReadOnly"),this.lg=a,this.g("isReadOnly",b,a))}},isEnabled:{configurable:!0,get:function(){return this.nd},set:function(a){var b=this.nd;b!==a&&(A(a,"boolean",Q,"isEnabled"),this.nd=a,this.g("isEnabled",
b,a))}},allowClipboard:{configurable:!0,get:function(){return this.Er},set:function(a){var b=this.Er;b!==a&&(A(a,"boolean",Q,"allowClipboard"),this.Er=a,this.g("allowClipboard",b,a))}},allowCopy:{configurable:!0,get:function(){return this.ki},set:function(a){var b=this.ki;b!==a&&(A(a,"boolean",Q,"allowCopy"),this.ki=a,this.g("allowCopy",b,a))}},allowDelete:{configurable:!0,get:function(){return this.li},set:function(a){var b=this.li;b!==a&&(A(a,"boolean",
Q,"allowDelete"),this.li=a,this.g("allowDelete",b,a))}},allowDragOut:{configurable:!0,get:function(){return this.Fr},set:function(a){var b=this.Fr;b!==a&&(A(a,"boolean",Q,"allowDragOut"),this.Fr=a,this.g("allowDragOut",b,a))}},allowDrop:{configurable:!0,get:function(){return this.Gr},set:function(a){var b=this.Gr;b!==a&&(A(a,"boolean",Q,"allowDrop"),this.Gr=a,this.g("allowDrop",b,a))}},allowTextEdit:{configurable:!0,get:function(){return this.vi},set:function(a){var b=
this.vi;b!==a&&(A(a,"boolean",Q,"allowTextEdit"),this.vi=a,this.g("allowTextEdit",b,a))}},allowGroup:{configurable:!0,get:function(){return this.mi},set:function(a){var b=this.mi;b!==a&&(A(a,"boolean",Q,"allowGroup"),this.mi=a,this.g("allowGroup",b,a))}},allowUngroup:{configurable:!0,get:function(){return this.wi},set:function(a){var b=this.wi;b!==a&&(A(a,"boolean",Q,"allowUngroup"),this.wi=a,this.g("allowUngroup",b,a))}},allowInsert:{configurable:!0,get:function(){return this.Ir},
set:function(a){var b=this.Ir;b!==a&&(A(a,"boolean",Q,"allowInsert"),this.Ir=a,this.g("allowInsert",b,a))}},allowLink:{configurable:!0,get:function(){return this.ni},set:function(a){var b=this.ni;b!==a&&(A(a,"boolean",Q,"allowLink"),this.ni=a,this.g("allowLink",b,a))}},allowRelink:{configurable:!0,get:function(){return this.pi},set:function(a){var b=this.pi;b!==a&&(A(a,"boolean",Q,"allowRelink"),this.pi=a,this.g("allowRelink",b,a))}},allowMove:{configurable:!0,
get:function(){return this.oi},set:function(a){var b=this.oi;b!==a&&(A(a,"boolean",Q,"allowMove"),this.oi=a,this.g("allowMove",b,a))}},allowReshape:{configurable:!0,get:function(){return this.ri},set:function(a){var b=this.ri;b!==a&&(A(a,"boolean",Q,"allowReshape"),this.ri=a,this.g("allowReshape",b,a))}},allowResize:{configurable:!0,get:function(){return this.si},set:function(a){var b=this.si;b!==a&&(A(a,"boolean",Q,"allowResize"),this.si=a,this.g("allowResize",b,a))}},
allowRotate:{configurable:!0,get:function(){return this.ti},set:function(a){var b=this.ti;b!==a&&(A(a,"boolean",Q,"allowRotate"),this.ti=a,this.g("allowRotate",b,a))}},allowSelect:{configurable:!0,get:function(){return this.ui},set:function(a){var b=this.ui;b!==a&&(A(a,"boolean",Q,"allowSelect"),this.ui=a,this.g("allowSelect",b,a))}},allowUndo:{configurable:!0,get:function(){return this.Jr},set:function(a){var b=this.Jr;b!==a&&(A(a,"boolean",Q,"allowUndo"),
this.Jr=a,this.g("allowUndo",b,a))}},allowZoom:{configurable:!0,get:function(){return this.Lr},set:function(a){var b=this.Lr;b!==a&&(A(a,"boolean",Q,"allowZoom"),this.Lr=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{configurable:!0,get:function(){return this.Dl},set:function(a){var b=this.Dl;b!==a&&(A(a,"boolean",Q,"hasVerticalScrollbar"),this.Dl=a,lj(this),this.P(),this.g("hasVerticalScrollbar",b,a),ij(this,!1))}},hasHorizontalScrollbar:{configurable:!0,
get:function(){return this.Cl},set:function(a){var b=this.Cl;b!==a&&(A(a,"boolean",Q,"hasHorizontalScrollbar"),this.Cl=a,lj(this),this.P(),this.g("hasHorizontalScrollbar",b,a),ij(this,!1))}},allowHorizontalScroll:{configurable:!0,get:function(){return this.Hr},set:function(a){var b=this.Hr;b!==a&&(A(a,"boolean",Q,"allowHorizontalScroll"),this.Hr=a,this.g("allowHorizontalScroll",b,a),ij(this,!1))}},allowVerticalScroll:{configurable:!0,get:function(){return this.Kr},set:function(a){var b=
this.Kr;b!==a&&(A(a,"boolean",Q,"allowVerticalScroll"),this.Kr=a,this.g("allowVerticalScroll",b,a),ij(this,!1))}},scrollHorizontalLineChange:{configurable:!0,get:function(){return this.kt},set:function(a){var b=this.kt;b!==a&&(A(a,"number",Q,"scrollHorizontalLineChange"),0>a&&ya(a,">= 0",Q,"scrollHorizontalLineChange"),this.kt=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{configurable:!0,get:function(){return this.ot},set:function(a){var b=this.ot;
b!==a&&(A(a,"number",Q,"scrollVerticalLineChange"),0>a&&ya(a,">= 0",Q,"scrollVerticalLineChange"),this.ot=a,this.g("scrollVerticalLineChange",b,a))}},lastInput:{configurable:!0,get:function(){return this.sh},set:function(a){F&&x(a,we,Q,"lastInput");this.sh=a}},firstInput:{configurable:!0,get:function(){return this.gg},set:function(a){F&&x(a,we,Q,"firstInput");this.gg=a}},currentCursor:{configurable:!0,get:function(){return this.Xr},set:function(a){""===a&&
(a=this.ao);if(this.Xr!==a){A(a,"string",Q,"currentCursor");var b=this.Aa,c=this.Ja;if(null!==b){this.Xr=a;var d=b.style.cursor;b.style.cursor=a;c.style.cursor=a;b.style.cursor===d&&(b.style.cursor="-webkit-"+a,c.style.cursor="-webkit-"+a,b.style.cursor===d&&(b.style.cursor="-moz-"+a,c.style.cursor="-moz-"+a,b.style.cursor===d&&(b.style.cursor=a,c.style.cursor=a)))}}}},defaultCursor:{configurable:!0,get:function(){return this.ao},set:function(a){""===a&&(a="auto");var b=this.ao;b!==
a&&(A(a,"string",Q,"defaultCursor"),this.ao=a,this.g("defaultCursor",b,a))}},click:{configurable:!0,get:function(){return this.$f},set:function(a){var b=this.$f;b!==a&&(null!==a&&A(a,"function",Q,"click"),this.$f=a,this.g("click",b,a))}},doubleClick:{configurable:!0,get:function(){return this.eg},set:function(a){var b=this.eg;b!==a&&(null!==a&&A(a,"function",Q,"doubleClick"),this.eg=a,this.g("doubleClick",b,a))}},contextClick:{configurable:!0,get:function(){return this.ag},
set:function(a){var b=this.ag;b!==a&&(null!==a&&A(a,"function",Q,"contextClick"),this.ag=a,this.g("contextClick",b,a))}},mouseOver:{configurable:!0,get:function(){return this.xg},set:function(a){var b=this.xg;b!==a&&(null!==a&&A(a,"function",Q,"mouseOver"),this.xg=a,this.g("mouseOver",b,a))}},mouseHover:{configurable:!0,get:function(){return this.vg},set:function(a){var b=this.vg;b!==a&&(null!==a&&A(a,"function",Q,"mouseHover"),this.vg=a,this.g("mouseHover",b,a))}},mouseHold:{configurable:!0,
enumerable:!0,get:function(){return this.ug},set:function(a){var b=this.ug;b!==a&&(null!==a&&A(a,"function",Q,"mouseHold"),this.ug=a,this.g("mouseHold",b,a))}},mouseDragOver:{configurable:!0,get:function(){return this.Ps},set:function(a){var b=this.Ps;b!==a&&(null!==a&&A(a,"function",Q,"mouseDragOver"),this.Ps=a,this.g("mouseDragOver",b,a))}},mouseDrop:{configurable:!0,get:function(){return this.sg},set:function(a){var b=this.sg;b!==a&&(F&&null!==a&&A(a,"function",Q,"mouseDrop"),
this.sg=a,this.g("mouseDrop",b,a))}},handlesDragDropForTopLevelParts:{configurable:!0,get:function(){return this.ss},set:function(a){var b=this.ss;b!==a&&(A(a,"boolean",Q,"handlesDragDropForTopLevelParts"),this.ss=a,this.g("handlesDragDropForTopLevelParts",b,a))}},mouseEnter:{configurable:!0,get:function(){return this.tg},set:function(a){var b=this.tg;b!==a&&(null!==a&&A(a,"function",Q,"mouseEnter"),this.tg=a,this.g("mouseEnter",b,a))}},mouseLeave:{configurable:!0,
get:function(){return this.wg},set:function(a){var b=this.wg;b!==a&&(null!==a&&A(a,"function",Q,"mouseLeave"),this.wg=a,this.g("mouseLeave",b,a))}},toolTip:{configurable:!0,get:function(){return this.Ig},set:function(a){var b=this.Ig;b!==a&&(!F||null===a||a instanceof Te||a instanceof bf||v("Diagram.toolTip must be an Adornment or HTMLInfo."),this.Ig=a,this.g("toolTip",b,a))}},contextMenu:{configurable:!0,get:function(){return this.bg},set:function(a){var b=this.bg;b!==
a&&(!F||a instanceof Te||a instanceof bf||v("Diagram.contextMenu must be an Adornment or HTMLInfo."),this.bg=a,this.g("contextMenu",b,a))}},commandHandler:{configurable:!0,get:function(){return this.Rr},set:function(a){this.Rr!==a&&(this.Rr=a,a.ie(this))}},toolManager:{configurable:!0,get:function(){return this.Ct},set:function(a){this.Ct!==a&&(x(a,Ta,Q,"toolManager"),this.Ct=a,a.diagram=this)}},defaultTool:{configurable:!0,get:function(){return this.cs},
set:function(a){var b=this.cs;b!==a&&(x(a,Oe,Q,"defaultTool"),this.cs=a,a.diagram=this,this.currentTool===b&&(this.currentTool=a))}},currentTool:{configurable:!0,get:function(){return this.Zr},set:function(a){var b=this.Zr;null!==b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&(x(a,Oe,Q,"currentTool"),this.Zr=a,a.diagram=this,a.doStart())}},selection:{configurable:!0,get:function(){return this.Dv}},maxSelectionCount:{configurable:!0,
enumerable:!0,get:function(){return this.Ls},set:function(a){var b=this.Ls;if(b!==a)if(A(a,"number",Q,"maxSelectionCount"),0<=a&&!isNaN(a)){if(this.Ls=a,this.g("maxSelectionCount",b,a),!this.undoManager.isUndoingRedoing&&(a=this.selection.count-a,0<a)){this.U("ChangingSelection",this.selection);b=this.selection.ta();for(var c=0;c<a;c++)b[c].isSelected=!1;this.U("ChangedSelection",this.selection)}}else ya(a,">= 0",Q,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{configurable:!0,
get:function(){return this.tp},set:function(a){var b=this.tp;b!==a&&(x(a,Te,Q,"nodeSelectionAdornmentTemplate"),this.tp=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{configurable:!0,get:function(){return this.Bo},set:function(a){var b=this.Bo;b!==a&&(x(a,Te,Q,"groupSelectionAdornmentTemplate"),this.Bo=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{configurable:!0,get:function(){return this.Uo},set:function(a){var b=
this.Uo;b!==a&&(x(a,Te,Q,"linkSelectionAdornmentTemplate"),this.Uo=a,this.g("linkSelectionAdornmentTemplate",b,a))}},highlighteds:{configurable:!0,get:function(){return this.cv}},isModified:{configurable:!0,get:function(){var a=this.undoManager;return a.isEnabled?null!==a.currentTransaction?!0:this.Fo&&this.Vd!==a.historyIndex:this.Fo},set:function(a){if(this.Fo!==a){A(a,"boolean",Q,"isModified");this.Fo=a;var b=this.undoManager;!a&&b.isEnabled&&(this.Vd=b.historyIndex);
a||jk(this)}}},model:{configurable:!0,get:function(){return this.gc},set:function(a){var b=this.gc;if(b!==a){x(a,W,Q,"model");this.currentTool.doCancel();null!==b&&b.undoManager!==a.undoManager&&b.undoManager.isInTransaction&&v("Do not replace a Diagram.model while a transaction is in progress.");this.animationManager.Tc(!0);var c=Ri(this,!0);this.we=!1;this.Tj=!0;this.Vd=-2;this.Ne=!1;var d=this.pc;this.pc=!0;Eh(this.animationManager,"Model");null!==b&&(null!==this.De&&this.De.each(function(a){b.Vk(a)}),
b.Vk(this.Wc));this.gc=a;this.partManager=kk(this.gc.type);for(var e=0;e<c.length;e++)this.add(c[e]);a.Sh(this.Hc);this.partManager.addAllModeledParts();a.Vk(this.Hc);a.Sh(this.Wc);null!==this.De&&this.De.each(function(b){a.Sh(b)});this.pc=d;this.Xb||this.P();null!==b&&a.undoManager.copyProperties(b.undoManager)}}},ba:{configurable:!0,get:function(){return this.mv},set:function(a){this.mv=a}},ju:{configurable:!0,get:function(){return this.Nx}},skipsModelSourceBindings:{configurable:!0,
enumerable:!0,get:function(){return this.Ev},set:function(a){this.Ev=a}},zu:{configurable:!0,get:function(){return this.tt},set:function(a){this.tt=a}},nodeTemplate:{configurable:!0,get:function(){return this.qf.K("")},set:function(a){var b=this.qf.K("");b!==a&&(x(a,S,Q,"nodeTemplate"),this.qf.add("",a),this.g("nodeTemplate",b,a),this.undoManager.isUndoingRedoing||this.Ld())}},nodeTemplateMap:{configurable:!0,get:function(){return this.qf},set:function(a){var b=
this.qf;b!==a&&(x(a,Db,Q,"nodeTemplateMap"),this.qf=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Ld())}},groupTemplate:{configurable:!0,get:function(){return this.qh.K("")},set:function(a){var b=this.qh.K("");b!==a&&(x(a,Hf,Q,"groupTemplate"),this.qh.add("",a),this.g("groupTemplate",b,a),this.undoManager.isUndoingRedoing||this.Ld())}},groupTemplateMap:{configurable:!0,get:function(){return this.qh},set:function(a){var b=this.qh;b!==a&&(x(a,Db,
Q,"groupTemplateMap"),this.qh=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Ld())}},linkTemplate:{configurable:!0,get:function(){return this.ng.K("")},set:function(a){var b=this.ng.K("");b!==a&&(x(a,R,Q,"linkTemplate"),this.ng.add("",a),this.g("linkTemplate",b,a),this.undoManager.isUndoingRedoing||this.Ld())}},linkTemplateMap:{configurable:!0,get:function(){return this.ng},set:function(a){var b=this.ng;b!==a&&(x(a,Db,Q,"linkTemplateMap"),this.ng=
a,this.g("linkTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Ld())}},isMouseCaptured:{configurable:!0,get:function(){return this.iv},set:function(a){var b=this.Aa;null!==b&&(b=b.La,b instanceof SVGElement||(a?(this.lastInput.bubbles=!1,this.yn?(this.removeEventListener(b,"pointermove",this.Tm,!1),this.removeEventListener(b,"pointerdown",this.Sm,!1),this.removeEventListener(b,"pointerup",this.Vm,!1),this.removeEventListener(b,"pointerout",this.Um,!1),this.addEventListener(qa,
"pointermove",this.Tm,!0),this.addEventListener(qa,"pointerdown",this.Sm,!0),this.addEventListener(qa,"pointerup",this.Vm,!0),this.addEventListener(qa,"pointerout",this.Um,!0)):(this.removeEventListener(b,"mousemove",this.Ok,!1),this.removeEventListener(b,"mousedown",this.Nk,!1),this.removeEventListener(b,"mouseup",this.Qk,!1),this.removeEventListener(b,"mouseout",this.Pk,!1),this.addEventListener(qa,"mousemove",this.Ok,!0),this.addEventListener(qa,"mousedown",this.Nk,!0),this.addEventListener(qa,
"mouseup",this.Qk,!0),this.addEventListener(qa,"mouseout",this.Pk,!0)),this.removeEventListener(b,"wheel",this.Rk,!1),this.addEventListener(qa,"wheel",this.Rk,!0),this.addEventListener(qa,"selectstart",this.preventDefault,!1)):(this.yn?(this.removeEventListener(qa,"pointermove",this.Tm,!0),this.removeEventListener(qa,"pointerdown",this.Sm,!0),this.removeEventListener(qa,"pointerup",this.Vm,!0),this.removeEventListener(qa,"pointerout",this.Um,!0),this.addEventListener(b,"pointermove",this.Tm,!1),this.addEventListener(b,
"pointerdown",this.Sm,!1),this.addEventListener(b,"pointerup",this.Vm,!1),this.addEventListener(b,"pointerout",this.Um,!1)):(this.removeEventListener(qa,"mousemove",this.Ok,!0),this.removeEventListener(qa,"mousedown",this.Nk,!0),this.removeEventListener(qa,"mouseup",this.Qk,!0),this.removeEventListener(qa,"mouseout",this.Pk,!0),this.addEventListener(b,"mousemove",this.Ok,!1),this.addEventListener(b,"mousedown",this.Nk,!1),this.addEventListener(b,"mouseup",this.Qk,!1),this.addEventListener(b,"mouseout",
this.Pk,!1)),this.removeEventListener(qa,"wheel",this.Rk,!0),this.removeEventListener(qa,"selectstart",this.preventDefault,!1),this.addEventListener(b,"wheel",this.Rk,!1)),this.iv=a))}},position:{configurable:!0,get:function(){return this.ra},set:function(a){var b=J.alloc().assign(this.ra);if(!b.A(a)){x(a,J,Q,"position");var c=this.viewportBounds.copy();this.ra.assign(a);fi(this.animationManager,b,this.ra);this.Xb||null===this.Aa&&!this.zm.o()||(this.Xb=!0,a=this.scale,kj(this,this.co,
this.Ea/a,this.Da/a,this.Mj,!1),this.Xb=!1);this.Xb||this.ir(c,this.viewportBounds,this.Fa,!1)}J.free(b)}},initialPosition:{configurable:!0,get:function(){return this.us},set:function(a){this.us.A(a)||(x(a,J,Q,"initialPosition"),this.us=a.J())}},initialScale:{configurable:!0,get:function(){return this.vs},set:function(a){this.vs!==a&&(A(a,"number",Q,"initialScale"),this.vs=a)}},grid:{configurable:!0,get:function(){null===this.Ob&&bj(this);return this.Ob},
set:function(a){var b=this.Ob;if(b!==a){null===b&&(bj(this),b=this.Ob);x(a,V,Q,"grid");a.type!==V.Grid&&v("Diagram.grid must be a Panel of type Panel.Grid");var c=b.panel;null!==c&&c.remove(b);this.Ob=a;a.name="GRID";null!==c&&c.add(a);Bj(this);this.P();this.g("grid",b,a)}}},viewportBounds:{configurable:!0,get:function(){var a=this.ey,b=this.ra,c=this.Fa;if(null===this.Aa)return this.zm.o()&&a.h(b.x,b.y,this.Ea/c,this.Da/c),a;a.h(b.x,b.y,Math.max(this.Ea,0)/c,Math.max(this.Da,0)/c);
return a}},viewSize:{configurable:!0,get:function(){return this.zm},set:function(a){var b=this.viewSize;b.A(a)||(x(a,Hb,Q,"viewSize"),this.zm=a=a.J(),this.Ea=a.width,this.Da=a.height,this.Ua(),this.g("viewSize",b,a))}},fixedBounds:{configurable:!0,get:function(){return this.ps},set:function(a){var b=this.ps;b.A(a)||(x(a,L,Q,"fixedBounds"),(F&&Infinity===a.width||-Infinity===a.width||Infinity===a.height||-Infinity===a.height)&&v("fixedBounds width/height must not be Infinity"),
this.ps=a=a.J(),this.Ua(),this.g("fixedBounds",b,a))}},scrollMargin:{configurable:!0,get:function(){return this.cj},set:function(a){"number"===typeof a?a=new lc(a):x(a,lc,Q,"scrollMargin");var b=this.cj;b.A(a)||(this.cj=a=a.J(),this.g("scrollMargin",b,a),this.mr())}},scrollMode:{configurable:!0,get:function(){return this.dj},set:function(a){var b=this.dj;b!==a&&(hb(a,Q,Q,"scrollMode"),this.dj=a,a===mi&&ij(this,!1),this.g("scrollMode",b,a),this.P())}},scrollsPageOnFocus:{configurable:!0,
enumerable:!0,get:function(){return this.pt},set:function(a){var b=this.pt;b!==a&&(A(a,"boolean",Q,"scrollsPageOnFocus"),this.pt=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{configurable:!0,get:function(){return this.ct},set:function(a){var b=this.ct;b!==a&&(null!==a&&A(a,"function",Q,"positionComputation"),this.ct=a,ij(this,!1),this.g("positionComputation",b,a))}},scaleComputation:{configurable:!0,get:function(){return this.it},set:function(a){var b=this.it;
b!==a&&(null!==a&&A(a,"function",Q,"scaleComputation"),this.it=a,hk(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{configurable:!0,get:function(){return this.co}},isVirtualized:{configurable:!0,get:function(){return this.Gs},set:function(a){var b=this.Gs;b!==a&&(A(a,"boolean",Q,"isVirtualized"),this.Gs=a,this.g("isVirtualized",b,a))}},scale:{configurable:!0,get:function(){return this.Fa},set:function(a){var b=this.Fa;C(a,Q,"scale");
b!==a&&hk(this,b,a)}},defaultScale:{configurable:!0,get:function(){return this.bo},set:function(a){F&&C(a,Q,"defaultScale");!F||0<a||v("defaultScale must be larger than zero, not: "+a);this.bo=a}},autoScale:{configurable:!0,get:function(){return this.$g},set:function(a){var b=this.$g;b!==a&&(hb(a,Q,Q,"autoScale"),this.$g=a,this.g("autoScale",b,a),a!==Wh&&ij(this,!1))}},initialAutoScale:{configurable:!0,get:function(){return this.jg},set:function(a){var b=
this.jg;b!==a&&(hb(a,Q,Q,"initialAutoScale"),this.jg=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{configurable:!0,get:function(){return this.ws},set:function(a){var b=this.ws;b!==a&&(x(a,M,Q,"initialViewportSpot"),a.cb()||v("initialViewportSpot must be a specific Spot: "+a),this.ws=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{configurable:!0,get:function(){return this.ts},set:function(a){var b=this.ts;b!==a&&(x(a,M,Q,"initialDocumentSpot"),a.cb()||
v("initialViewportSpot must be a specific Spot: "+a),this.ts=a,this.g("initialDocumentSpot",b,a))}},minScale:{configurable:!0,get:function(){return this.Ms},set:function(a){C(a,Q,"minScale");var b=this.Ms;b!==a&&(0<a?(this.Ms=a,this.g("minScale",b,a),a>this.scale&&(this.scale=a)):ya(a,"> 0",Q,"minScale"))}},maxScale:{configurable:!0,get:function(){return this.Ks},set:function(a){C(a,Q,"maxScale");var b=this.Ks;b!==a&&(0<a?(this.Ks=a,this.g("maxScale",b,a),a<this.scale&&
(this.scale=a)):ya(a,"> 0",Q,"maxScale"))}},zoomPoint:{configurable:!0,get:function(){return this.Kt},set:function(a){this.Kt.A(a)||(x(a,J,Q,"zoomPoint"),this.Kt=a=a.J())}},contentAlignment:{configurable:!0,get:function(){return this.Mj},set:function(a){var b=this.Mj;b.A(a)||(x(a,M,Q,"contentAlignment"),this.Mj=a=a.J(),this.g("contentAlignment",b,a),ij(this,!1))}},initialContentAlignment:{configurable:!0,get:function(){return this.Do},set:function(a){var b=
this.Do;b.A(a)||(x(a,M,Q,"initialContentAlignment"),this.Do=a=a.J(),this.g("initialContentAlignment",b,a))}},padding:{configurable:!0,get:function(){return this.mb},set:function(a){"number"===typeof a?a=new lc(a):x(a,lc,Q,"padding");var b=this.mb;b.A(a)||(this.mb=a=a.J(),this.Ua(),this.g("padding",b,a))}},partManager:{configurable:!0,get:function(){return this.Pa},set:function(a){var b=this.Pa;b!==a&&(x(a,Hi,Q,"partManager"),null!==a.diagram&&v("Cannot share PartManagers between Diagrams: "+
a.toString()),null!==b&&b.ie(null),this.Pa=a,a.ie(this))}},nodes:{configurable:!0,get:function(){return this.partManager.nodes.iterator}},links:{configurable:!0,get:function(){return this.partManager.links.iterator}},parts:{configurable:!0,get:function(){return this.partManager.parts.iterator}},layout:{configurable:!0,get:function(){return this.qc},set:function(a){var b=this.qc;b!==a&&(x(a,Mi,Q,"layout"),this.qc=a,a.diagram=this,a.group=null,
this.Zg=!0,this.g("layout",b,a),this.Jb())}},isTreePathToChildren:{configurable:!0,get:function(){return this.Fs},set:function(a){var b=this.Fs;if(b!==a&&(A(a,"boolean",Q,"isTreePathToChildren"),this.Fs=a,this.g("isTreePathToChildren",b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)Sk(a.value)}},treeCollapsePolicy:{configurable:!0,get:function(){return this.Et},set:function(a){var b=this.Et;b!==a&&(a!==Fi&&a!==Tk&&a!==Uk&&v("Unknown Diagram.treeCollapsePolicy: "+
a),this.Et=a,this.g("treeCollapsePolicy",b,a))}},Ue:{configurable:!0,get:function(){return this.fv},set:function(a){this.fv=a}},autoScrollInterval:{configurable:!0,get:function(){return this.Cn},set:function(a){var b=this.Cn;C(a,Q,"scale");b!==a&&(this.Cn=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{configurable:!0,get:function(){return this.En},set:function(a){"number"===typeof a?a=new lc(a):x(a,lc,Q,"autoScrollRegion");var b=this.En;b.A(a)||(this.En=
a=a.J(),this.Ua(),this.g("autoScrollRegion",b,a))}}});ma.Object.defineProperties(Q,{licenseKey:{configurable:!0,get:function(){return Vk.cc()},set:function(a){Vk.add(a)}},version:{configurable:!0,get:function(){return Wk}}});Q.prototype.makeImageData=Q.prototype.Uy;Q.prototype.makeImage=Q.prototype.WA;Q.prototype.addRenderer=Q.prototype.Dz;Q.prototype.makeSVG=Q.prototype.vw;Q.prototype.makeSvg=Q.prototype.lu;Q.prototype.stopAutoScroll=Q.prototype.Uf;
Q.prototype.doAutoScroll=Q.prototype.St;Q.prototype.isUnoccupied=Q.prototype.Kk;Q.prototype.raiseDiagramEvent=Q.prototype.U;Q.prototype.removeDiagramListener=Q.prototype.Ym;Q.prototype.addDiagramListener=Q.prototype.uk;Q.prototype.findTreeRoots=Q.prototype.yA;Q.prototype.layoutDiagram=Q.prototype.UA;Q.prototype.findTopLevelGroups=Q.prototype.rA;Q.prototype.findTopLevelNodesAndLinks=Q.prototype.sA;Q.prototype.ensureBounds=Q.prototype.Ya;Q.prototype.findLinksByExample=Q.prototype.Vt;
Q.prototype.findNodesByExample=Q.prototype.Wt;Q.prototype.findLinkForData=Q.prototype.Dc;Q.prototype.findNodeForData=Q.prototype.rj;Q.prototype.findPartForData=Q.prototype.Ec;Q.prototype.findLinkForKey=Q.prototype.findLinkForKey;Q.prototype.findNodeForKey=Q.prototype.Hb;Q.prototype.findPartForKey=Q.prototype.findPartForKey;Q.prototype.rebuildParts=Q.prototype.Ld;Q.prototype.transformViewToDoc=Q.prototype.Au;Q.prototype.transformRectDocToView=Q.prototype.vB;Q.prototype.transformDocToView=Q.prototype.xr;
Q.prototype.centerRect=Q.prototype.Nt;Q.prototype.scrollToRect=Q.prototype.Nw;Q.prototype.scroll=Q.prototype.scroll;Q.prototype.highlightCollection=Q.prototype.KA;Q.prototype.highlight=Q.prototype.JA;Q.prototype.selectCollection=Q.prototype.mB;Q.prototype.select=Q.prototype.select;Q.prototype.updateAllRelationshipsFromData=Q.prototype.zr;Q.prototype.updateAllTargetBindings=Q.prototype.updateAllTargetBindings;Q.prototype.commit=Q.prototype.commit;Q.prototype.rollbackTransaction=Q.prototype.Tf;
Q.prototype.commitTransaction=Q.prototype.bb;Q.prototype.startTransaction=Q.prototype.Ca;Q.prototype.raiseChanged=Q.prototype.g;Q.prototype.raiseChangedEvent=Q.prototype.hb;Q.prototype.removeChangedListener=Q.prototype.Vk;Q.prototype.addChangedListener=Q.prototype.Sh;Q.prototype.removeModelChangedListener=Q.prototype.iB;Q.prototype.addModelChangedListener=Q.prototype.ly;Q.prototype.findLayer=Q.prototype.Hm;Q.prototype.removeLayer=Q.prototype.gB;Q.prototype.addLayerAfter=Q.prototype.Az;
Q.prototype.addLayerBefore=Q.prototype.iy;Q.prototype.addLayer=Q.prototype.Bm;Q.prototype.moveParts=Q.prototype.moveParts;Q.prototype.copyParts=Q.prototype.Ck;Q.prototype.removeParts=Q.prototype.tu;Q.prototype.remove=Q.prototype.remove;Q.prototype.add=Q.prototype.add;Q.prototype.clearDelayedGeometries=Q.prototype.Tv;Q.prototype.setProperties=Q.prototype.Sw;Q.prototype.resetInputOptions=Q.prototype.Jw;Q.prototype.setInputOption=Q.prototype.nB;Q.prototype.getInputOption=Q.prototype.Lm;
Q.prototype.resetRenderingHints=Q.prototype.Kw;Q.prototype.setRenderingHint=Q.prototype.fz;Q.prototype.getRenderingHint=Q.prototype.Te;Q.prototype.maybeUpdate=Q.prototype.jd;Q.prototype.requestUpdate=Q.prototype.Jb;Q.prototype.delayInitialization=Q.prototype.Vz;Q.prototype.isUpdateRequested=Q.prototype.QA;Q.prototype.redraw=Q.prototype.We;Q.prototype.invalidateDocumentBounds=Q.prototype.Ua;Q.prototype.findObjectsNear=Q.prototype.Qg;Q.prototype.findPartsNear=Q.prototype.oA;
Q.prototype.findObjectsIn=Q.prototype.Lf;Q.prototype.findPartsIn=Q.prototype.Fy;Q.prototype.findObjectsAt=Q.prototype.sj;Q.prototype.findPartsAt=Q.prototype.nA;Q.prototype.findObjectAt=Q.prototype.$b;Q.prototype.findPartAt=Q.prototype.Im;Q.prototype.focusObject=Q.prototype.zA;Q.prototype.alignDocument=Q.prototype.Fz;Q.prototype.zoomToRect=Q.prototype.zB;Q.prototype.zoomToFit=Q.prototype.zoomToFit;Q.prototype.diagramScroll=Q.prototype.uy;Q.prototype.focus=Q.prototype.focus;Q.prototype.reset=Q.prototype.reset;
Q.useDOM=function(a){gh=a?void 0!==qa.document:!1};Q.isUsingDOM=function(){return gh};
var Pe=null,Gi=new Db,$i=null,Zi=null,gh=void 0!==qa.document,Pi=null,Qi="",Wh=new E(Q,"None",0),nj=new E(Q,"Uniform",1),oj=new E(Q,"UniformToFill",2),$f=new E(Q,"CycleAll",10),dg=new E(Q,"CycleNotDirected",11),fg=new E(Q,"CycleNotDirectedFast",12),gg=new E(Q,"CycleNotUndirected",13),ag=new E(Q,"CycleDestinationTree",14),cg=new E(Q,"CycleSourceTree",15),mi=new E(Q,"DocumentScroll",1),oi=new E(Q,"InfiniteScroll",2),Fi=new E(Q,"TreeParentCollapsed",21),Tk=new E(Q,"AllParentsCollapsed",22),Uk=new E(Q,
"AnyParentsCollapsed",23),Vk=new H,Wk="2.1.34",Rk=!1,Xk=null,Ci=!1;
function Di(){if(gh){var a=qa.document.createElement("canvas"),b=a.getContext("2d"),c=Ya("7ca11abfd022028846");b[c]=Ya("398c3597c01238");for(var d=["5da73c80a36455d5038e4972187c3cae51fd22",ra.Dx+"4ae6247590da4bb21c324ba3a84e385776",Ib.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",K.za],e=1;5>e;e++)b[Ya("7ca11abfd7330390")](Ya(d[e-1]),10,15*e);b[c]=Ya("39f046ebb36e4b");for(c=1;5>c;c++)b[Ya("7ca11abfd7330390")](Ya(d[c-1]),10,15*c);Xk=a}}Q.className="Diagram";
Q.fromDiv=function(a){var b=a;"string"===typeof a&&(b=qa.document.getElementById(a));return b instanceof HTMLDivElement&&b.B instanceof Q?b.B:null};Q.inherit=function(a,b){function c(){}if(Object.getPrototypeOf(a).prototype)throw Error("Used go.Diagram.inherit defining already defined class \n"+a);A(a,"function",Q,"inherit");A(b,"function",Q,"inherit");c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};Q.None=Wh;Q.Uniform=nj;Q.UniformToFill=oj;Q.CycleAll=$f;Q.CycleNotDirected=dg;
Q.CycleNotDirectedFast=fg;Q.CycleNotUndirected=gg;Q.CycleDestinationTree=ag;Q.CycleSourceTree=cg;Q.DocumentScroll=mi;Q.InfiniteScroll=oi;Q.TreeParentCollapsed=Fi;Q.AllParentsCollapsed=Tk;Q.AnyParentsCollapsed=Uk;function Ni(){this.wz=null;this.l="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.ff=this.l=!0:this.ff=null}
function Kj(a,b){b.Mb.setTransform(b.Yb,0,0,b.Yb,0,0);if(null===a.ff){b="f";var c=qa[Ya("76a715b2f73f148a")][Ya("72ba13b5")];a.ff=!0;if(gh){var d=Q[Ya("76a115b6ed251eaf4692")];if(d)for(var e=Vk.iterator;e.next();){d=e.value;d=Ya(d).split(Ya("39e9"));if(6>d.length)break;var f=Ya(d[1]).split(".");if("7da71ca0"!==d[4])break;var g=Ya(ra[Ya("6cae19")]).split(".");if(f[0]>g[0]||f[0]===g[0]&&f[1]>=g[1]){f=c[Ya("76ad18b4f73e")];for(g=c[Ya("73a612b6fb191d")](Ya("35e7"))+2;g<f;g++)b+=c[g];f=b[Ya("73a612b6fb191d")](Ya(d[2]));
0>f&&Ya(d[2])!==Ya("7da71ca0ad381e90")&&(f=b[Ya("73a612b6fb191d")](Ya("76a715b2ef3e149757")));0>f&&(f=b[Ya("73a612b6fb191d")](Ya("76a715b2ef3e149757")));0>f&&(f=c[Ya("73a612b6fb191d")](Ya("7baa19a6f76c1988428554")));a.ff=!(0<=f&&f<b[Ya("73a612b6fb191d")](Ya("35"))||-1===b[Ya("73a612b6fb191d")](Ya("35")));if(!a.ff)break;f=Ya(d[2]);if("#"!==f[0])break;g=qa.document.createElement("div");for(var h=d[0].replace(/[A-Za-z]/g,"");4>h.length;)h+="9";h=h.substr(h.length-4);d="";d+=["gsh","gsf"][parseInt(h.substr(0,
1),10)%2];d+=["Header","Background","Display","Feedback"][parseInt(h.substr(0,1),10)%4];g[Ya("79a417a0f0181a8946")]=d;if(qa.document[Ya("78a712aa")]){qa.document[Ya("78a712aa")][Ya("7bb806b6ed32388c4a875b")](g);h=qa.getComputedStyle(g).getPropertyValue(Ya("78a704b7e62456904c9b12701b6532a8"));qa.document[Ya("78a712aa")][Ya("68ad1bbcf533388c4a875b")](g);if(!h)break;if(-1!==h.indexOf(parseInt(f[1]+f[2],16))&&-1!==h.indexOf(parseInt(f[3]+f[4],16))){a.ff=!1;break}else if(Za||$a||bb||cb)for(d="."+d,f=0;f<
document.styleSheets.length;f++){g=document.styleSheets[f].rules||document.styleSheets[f].cssRules;for(var k in g)if(d===g[k].selectorText){a.ff=!1;break}}}else a.ff=null,a.ff=!1}}else{k=c[Ya("76ad18b4f73e")];for(e=c[Ya("73a612b6fb191d")](Ya("35e7"))+2;e<k;e++)b+=c[e];c=b[Ya("73a612b6fb191d")](Ya("7da71ca0ad381e90"));a.ff=!(0<=c&&c<b[Ya("73a612b6fb191d")](Ya("35")))}}}return 0<a.ff&&a!==a.wz?!0:!1}
function Oi(a,b){if(gh){void 0!==b&&null!==b||v("Diagram setup requires an argument DIV.");null!==a.Ja&&v("Diagram has already completed setup.");"string"===typeof b?a.Ja=qa.document.getElementById(b):b instanceof HTMLDivElement?a.Ja=b:v("No DIV or DIV id supplied: "+b);null===a.Ja&&v("Invalid DIV id; could not get element with id: "+b);void 0!==a.Ja.B&&v("Invalid div id; div already has a Diagram associated with it.");if(!a.em&&qa.ResizeObserver){var c=sa(function(){a.Jb()},250);a.em=new qa.ResizeObserver(function(){c()});
a.em.observe(a.Ja)}"static"===qa.getComputedStyle(a.Ja,null).position&&(a.Ja.style.position="relative");a.Ja.style["-webkit-tap-highlight-color"]="rgba(255, 255, 255, 0)";a.Ja.style["-ms-touch-action"]="none";a.Ja.innerHTML="";a.Ja.B=a;a.Ja.goDiagram=a;a.Ja.go=qa.go;var d=a.rq?new Pj(a):new Qk(a);void 0!==d.style&&(d.style.position="absolute",d.style.top="0px",d.style.left="0px","rtl"===qa.getComputedStyle(a.Ja,null).getPropertyValue("direction")&&(a.Nl=!0),d.style.zIndex="2",d.style.userSelect="none",
d.style.webkitUserSelect="none",d.style.MozUserSelect="none");a.Aa=d;a.Mb=d.context;b=a.Mb;a.Yb=a.computePixelRatio();a.Ea=a.Ja.clientWidth||1;a.Da=a.Ja.clientHeight||1;Rj(a,a.Ea,a.Da);a.ks=b.aa[Ya("7eba17a4ca3b1a8346")][Ya("78a118b7")](b.aa,Xk,4,4);a.Ja.insertBefore(d.La,a.Ja.firstChild);d=new Qk(null);d.width=1;d.height=1;a.Vu=d;a.Gx=d.context;if(gh){d=ua("div");var e=ua("div");d.style.position="absolute";d.style.overflow="auto";d.style.width=a.Ea+"px";d.style.height=a.Da+"px";d.style.zIndex="1";
e.style.position="absolute";e.style.width="1px";e.style.height="1px";a.Ja.appendChild(d);d.appendChild(e);d.onscroll=cj;d.addEventListener("mousedown",ej);d.addEventListener("touchstart",ej,{passive:!0});d.B=a;d.uz=!0;d.vz=!0;a.mt=d;a.Yp=e}a.mr=sa(function(){a.Jh=null;a.P()},300);a.kx=sa(function(){Xh(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.Ok=function(b){if(a.isEnabled){a.kg=!0;var c=sj(a,b,!0);a.doMouseMove();a.currentTool.isBeyondDragSize()&&(a.yd=0);yj(a,c,b)}};a.Nk=
function(b){if(a.isEnabled)if(a.kg=!0,a.xe)b.preventDefault();else{var c=sj(a,b,!0);c.down=!0;c.clickCount=b.detail;if($a||bb)b.timeStamp-a.ak<a.Dt&&!a.currentTool.isBeyondDragSize()?a.yd++:a.yd=1,a.ak=b.timeStamp,c.clickCount=a.yd;c.clone(a.firstInput);a.doMouseDown();1===b.button?b.preventDefault():yj(a,c,b)}};a.Qk=function(b){if(a.isEnabled)if(a.xe&&2===b.button)b.preventDefault();else if(a.xe&&0===b.button&&(a.xe=!1),a.rk)b.preventDefault();else{a.kg=!0;var c=sj(a,b,!0);c.up=!0;c.clickCount=b.detail;
if($a||bb)c.clickCount=a.yd;c.bubbles=b.bubbles;c.targetDiagram=uj(b);a.doMouseUp();a.Uf();yj(a,c,b)}};a.Rk=function(b){if(a.isEnabled){var c=sj(a,b,!0);c.bubbles=!0;var d=0,e=0;c.delta=0;void 0!==b.deltaX?(0!==b.deltaX&&(d=0<b.deltaX?1:-1),0!==b.deltaY&&(e=0<b.deltaY?1:-1),c.delta=Math.abs(b.deltaX)>Math.abs(b.deltaY)?-d:-e):void 0!==b.wheelDeltaX?(0!==b.wheelDeltaX&&(d=0<b.wheelDeltaX?-1:1),0!==b.wheelDeltaY&&(e=0<b.wheelDeltaY?-1:1),c.delta=Math.abs(b.wheelDeltaX)>Math.abs(b.wheelDeltaY)?-d:-e):
void 0!==b.wheelDelta&&0!==b.wheelDelta&&(c.delta=0<b.wheelDelta?1:-1);a.doMouseWheel();yj(a,c,b)}};a.Pk=function(b){a.isEnabled&&(a.kg=!1,sj(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())};a.ax=function(b){if(a.isEnabled){a.rk=!1;a.xe=!0;var c=vj(a,b,b.targetTouches[0],1<b.touches.length),d=null;0<b.targetTouches.length?d=b.targetTouches[0]:0<b.changedTouches.length&&(d=b.changedTouches[0]);if(null!==d){var e=d.screenX;d=d.screenY;var f=a.Po;b.timeStamp-a.ak<a.Dt&&!(25<Math.abs(f.x-
e)||25<Math.abs(f.y-d))?a.yd++:a.yd=1;c.clickCount=a.yd;a.ak=b.timeStamp;a.Po.h(e,d)}a.doMouseDown();yj(a,c,b)}};a.$w=function(b){if(a.isEnabled){var c=null;0<b.targetTouches.length?c=b.targetTouches[0]:0<b.changedTouches.length&&(c=b.changedTouches[0]);c=xj(a,b,c,1<b.touches.length);a.doMouseMove();yj(a,c,b)}};a.Zw=function(b){if(a.isEnabled)if(a.rk)b.preventDefault();else if(!(1<b.touches.length)){var c=null,d=null;0<b.targetTouches.length?d=b.targetTouches[0]:0<b.changedTouches.length&&(d=b.changedTouches[0]);
var e=wj(a,b,!1,!0,!1,!1);null!==d&&(c=qa.document.elementFromPoint(d.clientX,d.clientY),null!==c&&c.B instanceof Q&&c.B!==a&&tj(c.B,d,e),tj(a,d,e),e.clickCount=a.yd);null===c?e.targetDiagram=uj(b):c.B?e.targetDiagram=c.B:e.targetDiagram=null;e.targetObject=null;a.doMouseUp();yj(a,e,b);a.xe=!1}};a.Sm=function(b){if(a.isEnabled){a.kg=!0;var c=a.at;void 0===c[b.pointerId]&&(c[b.pointerId]=b);c=a.kk;var d=!1;if(null!==c[0]&&c[0].pointerId===b.pointerId)c[0]=b;else if(null!==c[1]&&c[1].pointerId===b.pointerId)c[1]=
b,d=!0;else if(null===c[0])c[0]=b;else if(null===c[1])c[1]=b,d=!0;else{b.preventDefault();return}if("touch"===b.pointerType||"pen"===b.pointerType)a.rk=!1,a.xe=!0;c=vj(a,b,b,d);d=a.Po;var e="touch"===b.pointerType||"pen"===b.pointerType?25:10;b.timeStamp-a.ak<a.Dt&&!(Math.abs(d.x-b.screenX)>e||Math.abs(d.y-b.screenY)>e)?a.yd++:a.yd=1;c.clickCount=a.yd;a.ak=b.timeStamp;a.Po.Ug(b.screenX,b.screenY);a.doMouseDown();1===b.button?b.preventDefault():yj(a,c,b)}};a.Tm=function(b){if(a.isEnabled){a.kg=!0;
var c=a.kk;if(null!==c[0]&&c[0].pointerId===b.pointerId)c[0]=b;else{if(null!==c[1]&&c[1].pointerId===b.pointerId){c[1]=b;return}if(null===c[0])c[0]=b;else return}c[0].pointerId===b.pointerId&&(c=xj(a,b,b,null!==c[1]),c.targetDiagram=uj(b),a.doMouseMove(),yj(a,c,b))}};a.Vm=function(b){if(a.isEnabled){a.kg=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.at;if(c&&a.rk)delete d[b.pointerId],b.preventDefault();else if(d=a.kk,null!==d[0]&&d[0].pointerId===b.pointerId){d[0]=null;d=wj(a,b,!1,
!0,!0,!1);var e=qa.document.elementFromPoint(b.clientX,b.clientY);null!==e&&e.B instanceof Q&&e.B!==a&&tj(e.B,b,d);tj(a,b,d);d.clickCount=a.yd;null===e?d.targetDiagram=uj(b):e.B?d.targetDiagram=e.B:d.targetDiagram=null;d.targetObject=null;a.doMouseUp();yj(a,d,b);c&&(a.xe=!1)}else null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null)}};a.Um=function(b){if(a.isEnabled){a.kg=!1;var c=a.at;c[b.pointerId]&&delete c[b.pointerId];c=a.kk;null!==c[0]&&c[0].pointerId===b.pointerId&&(c[0]=null);null!==c[1]&&
c[1].pointerId===b.pointerId&&(c[1]=null);"touch"!==b.pointerType&&"pen"!==b.pointerType&&(b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())}};b.zc(!0);aj(a)}}Ni.className="DiagramHelper";function mf(a){this.l=void 0===a?new J:a;this.w=new J}ma.Object.defineProperties(mf.prototype,{point:{configurable:!0,get:function(){return this.l},set:function(a){this.l=a}},shifted:{configurable:!0,get:function(){return this.w},set:function(a){this.w=a}}});mf.className="DraggingInfo";
function ck(a,b,c){this.node=a;this.info=b;this.nw=c}ck.className="DraggingNodeInfoPair";function ef(){this.reset()}ef.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new Hb(NaN,NaN)).freeze();this.gridSnapCellSpot=Hc;this.gridSnapOrigin=(new J(NaN,NaN)).freeze();this.groupsSnapMembers=this.dragsTree=this.dragsLink=!1;this.dragsMembers=this.groupsAlwaysMove=!0};ef.className="DraggingOptions";
function Yk(a){1<arguments.length&&v("Palette constructor can only take one optional argument, the DIV HTML element or its id.");Q.call(this,a);Zk(this)}la(Yk,Q);function Zk(a){a.allowDragOut=!0;a.allowMove=!1;a.isReadOnly=!0;a.contentAlignment=Ic;a.layout=new $k}Yk.prototype.reset=function(){Q.prototype.reset.call(this);Zk(this)};Yk.className="Palette";
function al(a){1<arguments.length&&v("Overview constructor can only take one optional argument, the DIV HTML element or its id.");Q.call(this,a);var b=this;this.animationManager.isEnabled=!1;this.Xb=!0;this.Oa=null;this.Dl=this.Cl=!1;this.w=this.L=!0;this.jb=0;this.W=!1;this.mm=null;this.fz("drawShadows",!1);var c=new S,d=new Yf;d.stroke="magenta";d.strokeWidth=2;d.fill="transparent";d.name="BOXSHAPE";c.selectable=!0;c.selectionAdorned=!1;c.selectionObjectName="BOXSHAPE";c.locationObjectName="BOXSHAPE";
c.resizeObjectName="BOXSHAPE";c.cursor="move";c.add(d);this.l=c;this.allowDelete=this.allowCopy=!1;this.allowSelect=!0;this.autoScrollRegion=new lc(0,0,0,0);this.ra.h(0,0);this.toolManager.eb("Dragging",new bl,this.toolManager.mouseMoveTools);this.click=function(){var a=b.observed;if(null!==a){var c=a.viewportBounds,d=b.lastInput.documentPoint;a.position=new J(d.x-c.width/2,d.y-c.height/2)}};this.hi=function(){b.Ua();cl(b)};this.gi=function(){null!==b.observed&&(b.Ua(),b.P())};this.Vc=function(){1>
b.updateDelay?b.P():b.W||(b.W=!0,setTimeout(function(){b.W=!1;var a=b.Aa,c=b.Mb;if(null!==a&&null!==c){Ij(b);if(null===b.mm){var d=new Qk(null);d.width=a.width;d.height=a.height;b.mm=d}try{b.Aa=b.mm,b.Mb=b.Aa.context,b.Mb.zc(!0),b.Mb.setTransform(1,0,0,1,0,0),b.Mb.clearRect(0,0,b.Aa.width,b.Aa.height),dl(b)}finally{b.Aa=a,b.Mb=c}}b.P()},b.updateDelay))};this.Nd=function(){null!==b.observed&&cl(b)};this.autoScale=nj;this.Xb=!1}la(al,Q);al.prototype.computePixelRatio=function(){return 1};
al.prototype.hc=function(){null===this.Ja&&v("No div specified");null===this.Aa&&v("No canvas specified");if(!(this.Aa instanceof Pj)&&(xi(this.box),this.Jc)){var a=this.observed;if(null!==a&&!a.animationManager.isAnimating&&a.Aj){Ij(this);var b=this.Aa;a=this.Mb;a.zc(!0);a.setTransform(1,0,0,1,0,0);a.clearRect(0,0,b.width,b.height);1>this.updateDelay?dl(this):null!==this.mm&&(a.drawImage(this.mm.La,0,0),b=this.tb,b.reset(),1!==this.scale&&b.scale(this.scale),0===this.position.x&&0===this.position.y||
b.translate(-this.position.x,-this.position.y),a.scale(this.Yb,this.Yb),a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy));b=this.Qa.j;for(var c=b.length,d=0;d<c;d++)b[d].hc(a,this);this.Jc=this.Hi=!1}}};
function dl(a){var b=a.observed;if(null!==b){var c=a.drawsTemporaryLayers,d=a.drawsGrid&&c,e=b.grid;d&&null!==e&&e.visible&&!isNaN(e.width)&&!isNaN(e.height)&&(e=L.alloc().assign(a.viewportBounds).Uc(b.viewportBounds),Bj(b,e),L.free(e),gj(b));var f=a.tb;f.reset();1!==a.scale&&f.scale(a.scale);0===a.position.x&&0===a.position.y||f.translate(-a.position.x,-a.position.y);e=a.Mb;e.scale(a.Yb,a.Yb);e.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy);b=b.Qa.j;f=b.length;for(var g=0;g<f;g++){var h=b[g],k=a;if(h.visible&&
0!==h.opacity){var l=h.diagram.grid.part;if(!c&&h.isTemporary)d&&l.layer===h&&(h=yi(h,e),l.hc(e,k),e.globalAlpha=h);else{for(var m=yi(h,e),n=k.scale,p=L.alloc(),r=h.Ia.j,q=r.length,u=0;u<q;u++){var w=r[u];(d||w!==l)&&h.oj(e,w,k,null,n,p,!1)}L.free(p);e.globalAlpha=m}}}}}
function cl(a){var b=a.box;if(null!==b){var c=a.observed;if(null!==c){a.Jc=!0;c=c.viewportBounds;var d=b.selectionObject,e=Hb.alloc();e.h(c.width,c.height);d.desiredSize=e;Hb.free(e);a=2/a.scale;d instanceof Yf&&(d.strokeWidth=a);b.location=new J(c.x-a/2,c.y-a/2);b.isSelected=!0}}}al.prototype.computeBounds=function(){var a=this.observed;if(null===a)return vc;var b=a.documentBounds.copy();b.Uc(a.viewportBounds);return b};al.prototype.Ry=function(){!0!==this.Jc&&(this.Jc=!0,this.Jb())};
al.prototype.ir=function(a,b,c,d){this.Xb||(fj(this),this.P(),lj(this),this.Ua(),cl(this),this.ce.scale=c,this.ce.position.x=a.x,this.ce.position.y=a.y,this.ce.bounds.assign(a),this.ce.uw=d,this.U("ViewportBoundsChanged",this.ce,a))};
ma.Object.defineProperties(al.prototype,{observed:{configurable:!0,get:function(){return this.Oa},set:function(a){var b=this.Oa;null!==a&&x(a,Q,al,"observed");a instanceof al&&v("Overview.observed Diagram may not be an Overview itself: "+a);if(b!==a){null!==b&&(this.remove(this.box),b.Ym("ViewportBoundsChanged",this.hi),b.Ym("DocumentBoundsChanged",this.gi),b.Ym("InvalidateDraw",this.Vc),b.Ym("AnimationFinished",this.Nd));this.Oa=a;null!==a&&(a.uk("ViewportBoundsChanged",this.hi),a.uk("DocumentBoundsChanged",
this.gi),a.uk("InvalidateDraw",this.Vc),a.uk("AnimationFinished",this.Nd),this.add(this.box));this.Ua();if(null===a){this.mm=null;var c=this.Aa,d=this.Mb;c&&d&&(d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c.width,c.height))}else this.Vc(null),cl(this),this.P();this.g("observed",b,a)}}},box:{configurable:!0,get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(this.l=a,this.remove(b),this.add(this.l),cl(this),this.g("box",b,a))}},drawsTemporaryLayers:{configurable:!0,
get:function(){return this.L},set:function(a){this.L!==a&&(this.L=a,this.We())}},drawsGrid:{configurable:!0,get:function(){return this.w},set:function(a){this.w!==a&&(this.w=a,this.We())}},updateDelay:{configurable:!0,get:function(){return this.jb},set:function(a){0>a&&(a=0);this.jb!==a&&(this.jb=a)}}});al.className="Overview";function bl(){df.call(this);this.l=null}la(bl,df);
bl.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||!a.allowMove||!a.allowSelect)return!1;var b=a.observed;if(null===b)return!1;var c=a.lastInput;if(!c.left||a.currentTool!==this&&(!this.isBeyondDragSize()||c.isTouchEvent&&c.timestamp-a.firstInput.timestamp<this.delay))return!1;null===this.findDraggablePart()&&(c=b.viewportBounds,this.l=new J(c.width/2,c.height/2),a=a.firstInput.documentPoint,b.position=new J(a.x-this.l.x,a.y-this.l.y));return!0};
bl.prototype.doActivate=function(){this.l=null;df.prototype.doActivate.call(this)};bl.prototype.doUpdateCursor=function(){var a=this.diagram,b=a.box;null!==b&&b.cursor&&(a.currentCursor=b.cursor)};bl.prototype.moveParts=function(){var a=this.diagram,b=a.observed;if(null!==b){var c=a.box;if(null!==c){if(null===this.l){var d=a.firstInput.documentPoint;c=c.location;this.l=new J(d.x-c.x,d.y-c.y)}a=a.lastInput.documentPoint;b.position=new J(a.x-this.l.x,a.y-this.l.y)}}};bl.className="OverviewDraggingTool";
function el(){0<arguments.length&&za(el);fb(this);this.B=Pe;this.jb=this.L=this.w=!0;this.W=this.Oa=this.Vc=this.Pa=!1;this.Ui=this.l=null;this.Nd=1.05;this.nv=NaN;this.Lx=null;this.Ov=NaN;this.Nv=vc;this.Hc=!0;this.Dg=null;this.Wc=200}el.prototype.toString=function(){return"CommandHandler"};el.prototype.ie=function(a){this.B=a};
el.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput,c=db?b.meta:b.control,d=b.shift,e=b.alt,f=b.key;!c||"C"!==f&&"Insert"!==f?c&&"X"===f||d&&"Del"===f?this.canCutSelection()&&this.cutSelection():c&&"V"===f||d&&"Insert"===f?this.canPasteSelection()&&this.pasteSelection():c&&"Y"===f||e&&d&&"Backspace"===f?this.canRedo()&&this.redo():c&&"Z"===f||e&&"Backspace"===f?this.canUndo()&&this.undo():"Del"===f||"Backspace"===f?this.canDeleteSelection()&&this.deleteSelection():c&&"A"===f?this.canSelectAll()&&
this.selectAll():"Esc"===f?this.canStopCommand()&&this.stopCommand():"Up"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","up"):a.scroll("line","up")):"Down"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","down"):a.scroll("line","down")):"Left"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","left"):a.scroll("line","left")):"Right"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","right"):a.scroll("line","right")):"PageUp"===f?d&&a.allowHorizontalScroll?a.scroll("page","left"):a.allowVerticalScroll&&
a.scroll("page","up"):"PageDown"===f?d&&a.allowHorizontalScroll?a.scroll("page","right"):a.allowVerticalScroll&&a.scroll("page","down"):"Home"===f?c&&a.allowVerticalScroll?a.scroll("document","up"):!c&&a.allowHorizontalScroll&&a.scroll("document","left"):"End"===f?c&&a.allowVerticalScroll?a.scroll("document","down"):!c&&a.allowHorizontalScroll&&a.scroll("document","right"):" "===f?this.canScrollToPart()&&this.scrollToPart():"Subtract"===f?this.canDecreaseZoom()&&this.decreaseZoom():"Add"===f?this.canIncreaseZoom()&&
this.increaseZoom():c&&"0"===f?this.canResetZoom()&&this.resetZoom():d&&"Z"===f?this.canZoomToFit()&&this.zoomToFit():c&&!d&&"G"===f?this.canGroupSelection()&&this.groupSelection():c&&d&&"G"===f?this.canUngroupSelection()&&this.ungroupSelection():b.event&&113===b.event.which?this.canEditTextBlock()&&this.editTextBlock():b.event&&93===b.event.which?this.canShowContextMenu()&&this.showContextMenu():b.bubbles=!0:this.canCopySelection()&&this.copySelection()};
el.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};el.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof Ta&&a.allowSelect&&a.clearSelection();null!==b&&b.doCancel()};el.prototype.canStopCommand=function(){return!0};
el.prototype.selectAll=function(){var a=this.diagram;a.P();try{a.currentCursor="wait";a.U("ChangingSelection",a.selection);for(var b=a.parts;b.next();)b.value.isSelected=!0;for(var c=a.nodes;c.next();)c.value.isSelected=!0;for(var d=a.links;d.next();)d.value.isSelected=!0}finally{a.U("ChangedSelection",a.selection),a.currentCursor=""}};el.prototype.canSelectAll=function(){return this.diagram.allowSelect};
el.prototype.deleteSelection=function(){var a=this.diagram;try{a.currentCursor="wait";a.U("ChangingSelection",a.selection);a.Ca("Delete");a.U("SelectionDeleting",a.selection);for(var b=new I,c=a.selection.iterator;c.next();)fl(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});a.tu(b,!0);a.U("SelectionDeleted",b)}finally{a.bb("Delete"),a.U("ChangedSelection",a.selection),a.currentCursor=""}};
el.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};el.prototype.copySelection=function(){var a=this.diagram,b=new I;for(a=a.selection.iterator;a.next();)fl(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};el.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1};
el.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};el.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1};
el.prototype.copyToClipboard=function(a){var b=this.diagram,c=null;if(null===a)Pi=null,Qi="";else{c=b.model;var d=!1,e=!1,f=null;try{c.Om()&&(d=c.Bk,c.Bk=this.copiesParentKey),c.Jk()&&(e=c.Ak,c.Ak=this.copiesGroupKey),f=b.Ck(a,null,!0)}finally{c.Om()&&(c.Bk=d),c.Jk()&&(c.Ak=e),c=new H,c.addAll(f),Pi=c,Qi=b.model.dataFormat}}b.U("ClipboardChanged",c)};
el.prototype.pasteFromClipboard=function(){var a=new I,b=Pi;if(null===b)return a;var c=this.diagram;if(Qi!==c.model.dataFormat)return a;var d=c.model,e=!1,f=!1,g=null;try{d.Om()&&(e=d.Bk,d.Bk=this.copiesParentKey),d.Jk()&&(f=d.Ak,d.Ak=this.copiesGroupKey),g=c.Ck(b,c,!1)}finally{for(d.Om()&&(d.Bk=e),d.Jk()&&(d.Ak=f),b=g.iterator;b.next();)c=b.value,d=b.key,c.location.o()||(d.location.o()?c.location=d.location:!c.position.o()&&d.position.o()&&(c.position=d.position)),a.add(c)}return a};
el.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.currentCursor="wait";b.U("ChangingSelection",b.selection);b.Ca("Paste");var c=this.pasteFromClipboard();0<c.count&&b.clearSelection(!0);for(var d=c.iterator;d.next();)d.value.isSelected=!0;if(null!==a){var e=b.computePartsBounds(b.selection);if(e.o()){var f=this.computeEffectiveCollection(b.selection,b.pl);Ef(b,f,new J(a.x-e.centerX,a.y-e.centerY),b.pl,!1)}}b.U("ClipboardPasted",c)}finally{b.bb("Paste"),b.U("ChangedSelection",
b.selection),b.currentCursor=""}};el.prototype.canPasteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowClipboard||null===Pi||0===Pi.count||Qi!==a.model.dataFormat?!1:!0};el.prototype.undo=function(){this.diagram.undoManager.undo()};el.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};el.prototype.redo=function(){this.diagram.undoManager.redo()};
el.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};el.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);C(a,el,"decreaseZoom:factor");var b=this.diagram;b.autoScale===Wh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};
el.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);C(a,el,"canDecreaseZoom:factor");var b=this.diagram;if(b.autoScale!==Wh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};el.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);C(a,el,"increaseZoom:factor");var b=this.diagram;b.autoScale===Wh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};
el.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);C(a,el,"canIncreaseZoom:factor");var b=this.diagram;if(b.autoScale!==Wh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};el.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);C(a,el,"resetZoom:newscale");var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)};
el.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);C(a,el,"canResetZoom:newscale");var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
el.prototype.zoomToFit=function(){var a=this.diagram,b=a.animationManager;b.Tc();a.We();var c=a.position,d=a.scale;Eh(b,"Zoom To Fit");this.isZoomToFitRestoreEnabled&&d===this.Ov&&!isNaN(this.nv)&&a.documentBounds.A(this.Nv)?(a.scale=this.nv,a.position=this.Lx,this.Ov=NaN,this.Nv=vc):(this.nv=d,this.Lx=c.copy(),a.zoomToFit(),this.Ov=a.scale,this.Nv=a.documentBounds.copy());Gh(b)};el.prototype.canZoomToFit=function(){return this.diagram.allowZoom};
el.prototype.scrollToPart=function(a){void 0===a&&(a=null);null!==a&&x(a,S,el,"part");var b=this.diagram;b.Ya();if(null===a){try{null!==this.Dg&&(this.Dg.next()?a=this.Dg.value:this.Dg=null)}catch(k){this.Dg=null}null===a&&(0<b.highlighteds.count?this.Dg=b.highlighteds.iterator:0<b.selection.count&&(this.Dg=b.selection.iterator),null!==this.Dg&&this.Dg.next()&&(a=this.Dg.value))}if(null!==a){var c=b.animationManager;Eh(c,"Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=gl(this,a,[a]);
if(1===e.length)b.Ca(),b.Nt(a.actualBounds),b.bb("Scroll To Part");else{var f=function(){b.Ca();for(var a=e.pop();0<e.length&&a instanceof U&&a.isTreeExpanded&&(!(a instanceof Hf)||a.isSubGraphExpanded);)a=e.pop();0<e.length?(a instanceof S&&b.Nw(a.actualBounds),a instanceof U&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof Hf&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof S&&b.Nt(a.actualBounds),b.Ym("LayoutCompleted",g));b.bb("Scroll To Part")},g=function(){ta(f,(c.isEnabled?
c.duration:0)+d)};b.uk("LayoutCompleted",g);f()}}else{var h=b.position.copy();b.Nt(a.actualBounds);h.Ta(b.position)&&c.Tc()}}};
function gl(a,b,c){if(b.isVisible())return c;if(b instanceof Te)gl(a,b.adornedPart,c);else if(b instanceof R){var d=b.fromNode;null!==d&&gl(a,d,c);b=b.toNode;null!==b&&gl(a,b,c)}else b instanceof U&&(d=b.labeledLink,null!==d&&gl(a,d,c),d=b.Rg(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),gl(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),gl(a,b,c));return c}
el.prototype.canScrollToPart=function(a){void 0===a&&(a=null);if(null!==a&&!(a instanceof S))return!1;a=this.diagram;return 0===a.selection.count&&0===a.highlighteds.count?!1:a.allowHorizontalScroll&&a.allowVerticalScroll};
el.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ca("Collapse Tree");Eh(b.animationManager,"Collapse Tree");var c=new H;if(null!==a&&a.isTreeExpanded)a.collapseTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof U&&e.isTreeExpanded&&(e.collapseTree(),c.add(e))}b.U("TreeCollapsed",c)}finally{b.bb("Collapse Tree")}};
el.prototype.canCollapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof U&&a.isTreeExpanded))return!1;if(0<a.Sq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof U&&b.isTreeExpanded&&0<b.Sq().count)return!0;return!1};
el.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ca("Expand Tree");Eh(b.animationManager,"Expand Tree");var c=new H;if(null!==a&&!a.isTreeExpanded)a.expandTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof U&&!e.isTreeExpanded&&(e.expandTree(),c.add(e))}b.U("TreeExpanded",c)}finally{b.bb("Expand Tree")}};
el.prototype.canExpandTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof U)||a.isTreeExpanded)return!1;if(0<a.Sq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof U&&!b.isTreeExpanded&&0<b.Sq().count)return!0;return!1};
el.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.zj()){var c=this.archetypeGroupData;if(null!==c){var d=null;try{a.currentCursor="wait";a.U("ChangingSelection",a.selection);a.Ca("Group");for(var e=new H,f=a.selection.iterator;f.next();){var g=f.value;g.bc()&&g.canGroup()&&e.add(g)}for(var h=new H,k=e.iterator;k.next();){var l=k.value;f=!1;for(var m=e.iterator;m.next();)if(l.Jd(m.value)){f=!0;break}f||h.add(l)}if(0<h.count){var n=h.first().containingGroup;if(null!==n)for(;null!==
n;){e=!1;for(var p=h.iterator;p.next();)if(!p.value.Jd(n)){e=!0;break}if(e)n=n.containingGroup;else break}if(c instanceof Hf)Lg(c),d=c.copy(),null!==d&&a.add(d);else if(b.fu(c)){var r=b.copyNodeData(c);Fa(r)&&(b.Gf(r),d=a.rj(r))}if(null!==d){null!==n&&this.isValidMember(n,d)&&(d.containingGroup=n);for(var q=h.iterator;q.next();){var u=q.value;this.isValidMember(d,u)&&(u.containingGroup=d)}a.clearSelection(!0);d.isSelected=!0}}a.U("SelectionGrouped",d)}finally{a.bb("Group"),a.U("ChangedSelection",
a.selection),a.currentCursor=""}}}};el.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.zj()||null===this.archetypeGroupData)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.bc()&&b.canGroup())return!0}return!1};
function hl(a){var b=La();for(a=a.iterator;a.next();){var c=a.value;c instanceof R||b.push(c)}a=new I;c=b.length;for(var d=0;d<c;d++){for(var e=b[d],f=!0,g=0;g<c;g++)if(e.Jd(b[g])){f=!1;break}f&&a.add(e)}Oa(b);return a}
el.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof R)return!1;if(null!==a){if(a===b||a.Jd(b))return!1;var c=a.memberValidation;if(null!==c&&!c(a,b)||null===a.data&&null!==b.data||null!==a.data&&null===b.data)return!1}c=this.memberValidation;return null!==c?c(a,b):!0};
el.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.zj())try{b.currentCursor="wait";b.U("ChangingSelection",b.selection);b.Ca("Ungroup");var d=new H;if(null!==a)d.add(a);else for(var e=b.selection.iterator;e.next();){var f=e.value;f instanceof Hf&&f.canUngroup()&&d.add(f)}var g=new H;if(0<d.count){b.clearSelection(!0);for(var h=d.iterator;h.next();){var k=h.value;k.expandSubGraph();var l=k.containingGroup,m=null!==l&&null!==l.data?c.pa(l.data):void 0;g.addAll(k.memberParts);
for(var n=g.iterator;n.next();){var p=n.value;p.isSelected=!0;if(!(p instanceof R)){var r=p.data;null!==r?c.tr(r,m):p.containingGroup=l}}b.remove(k)}}b.U("SelectionUngrouped",d,g)}finally{b.bb("Ungroup"),b.U("ChangedSelection",b.selection),b.currentCursor=""}};
el.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.zj())return!1;if(null!==a){if(!(a instanceof Hf))return!1;if(a.canUngroup())return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof Hf&&b.canUngroup())return!0;return!1};
el.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=hl(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c};
el.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ca("Collapse SubGraph");Eh(b.animationManager,"Collapse SubGraph");var c=new H;if(null!==a&&a.isSubGraphExpanded)a.collapseSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof Hf&&e.isSubGraphExpanded&&(e.collapseSubGraph(),c.add(e))}b.U("SubGraphCollapsed",c)}finally{b.bb("Collapse SubGraph")}};
el.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof Hf&&a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof Hf&&b.isSubGraphExpanded)return!0;return!1};
el.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ca("Expand SubGraph");Eh(b.animationManager,"Expand SubGraph");var c=new H;if(null!==a&&!a.isSubGraphExpanded)a.expandSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof Hf&&!e.isSubGraphExpanded&&(e.expandSubGraph(),c.add(e))}b.U("SubGraphExpanded",c)}finally{b.bb("Expand SubGraph")}};
el.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof Hf&&!a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof Hf&&!b.isSubGraphExpanded)return!0;return!1};
el.prototype.editTextBlock=function(a){void 0===a&&(a=null);null!==a&&x(a,ih,el,"editTextBlock");var b=this.diagram,c=b.toolManager.findTool("TextEditing");if(null!==c){if(null===a){a=null;for(var d=b.selection.iterator;d.next();){var e=d.value;if(e.canEdit()){a=e;break}}if(null===a)return;a=a.Gm(function(a){return a instanceof ih&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}};
el.prototype.canEditTextBlock=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowTextEdit||null===b.toolManager.findTool("TextEditing"))return!1;if(null!==a){if(!(a instanceof ih))return!1;a=a.part;if(null!==a&&a.canEdit())return!0}else for(b=b.selection.iterator;b.next();)if(a=b.value,a.canEdit()&&(a=a.Gm(function(a){return a instanceof ih&&a.editable}),null!==a))return!0;return!1};
el.prototype.showContextMenu=function(a){var b=this.diagram,c=b.toolManager.findTool("ContextMenu");if(null!==c&&(void 0===a&&(a=0<b.selection.count?b.selection.first():b),a=c.findObjectWithContextMenu(a),null!==a)){var d=b.lastInput,e=null;a instanceof N?e=a.ma(Mc):b.viewportBounds.fa(d.documentPoint)||(e=b.viewportBounds,e=new J(e.x+e.width/2,e.y+e.height/2));null!==e&&(d.viewPoint=b.xr(e),d.documentPoint=e,d.left=!1,d.right=!0,d.up=!0);b.currentTool=c;eh(c,!1,a)}};
el.prototype.canShowContextMenu=function(a){var b=this.diagram,c=b.toolManager.findTool("ContextMenu");if(null===c)return!1;void 0===a&&(a=0<b.selection.count?b.selection.first():b);return null===c.findObjectWithContextMenu(a)?!1:!0};
el.prototype.computeEffectiveCollection=function(a,b){var c=this.diagram,d=c.toolManager.findTool("Dragging"),e=c.currentTool===d;void 0===b&&(b=e?d.dragOptions:c.pl);d=new Db;if(null===a)return d;for(var f=a.iterator;f.next();)ak(c,d,f.value,e,b);if(null!==c.draggedLink&&b.dragsLink)return d;for(f=a.iterator;f.next();)a=f.value,a instanceof R&&(b=a.fromNode,null===b||d.contains(b)?(b=a.toNode,null===b||d.contains(b)||d.remove(a)):d.remove(a));return d};
ma.Object.defineProperties(el.prototype,{diagram:{configurable:!0,get:function(){return this.B}},copiesClipboardData:{configurable:!0,get:function(){return this.w},set:function(a){A(a,"boolean",el,"copiesClipboardData");this.w=a}},copiesConnectedLinks:{configurable:!0,get:function(){return this.L},set:function(a){A(a,"boolean",el,"copiesConnectedLinks");this.L=a}},deletesConnectedLinks:{configurable:!0,get:function(){return this.jb},set:function(a){A(a,
"boolean",el,"deletesConnectedLinks");this.jb=a}},copiesTree:{configurable:!0,get:function(){return this.Pa},set:function(a){A(a,"boolean",el,"copiesTree");this.Pa=a}},deletesTree:{configurable:!0,get:function(){return this.Vc},set:function(a){A(a,"boolean",el,"deletesTree");this.Vc=a}},copiesParentKey:{configurable:!0,get:function(){return this.Oa},set:function(a){A(a,"boolean",el,"copiesParentKey");this.Oa=a}},copiesGroupKey:{configurable:!0,
get:function(){return this.W},set:function(a){A(a,"boolean",el,"copiesGroupKey");this.W=a}},archetypeGroupData:{configurable:!0,get:function(){return this.l},set:function(a){null!==a&&A(a,"object",el,"archetypeGroupData");var b=this.diagram;F&&(b=b.model,!b.zj()||a instanceof Hf||b.fu(a)||v("CommandHandler.archetypeGroupData must be either a Group or a data object for which GraphLinksModel.isGroupForNodeData is true: "+a));this.l=a}},memberValidation:{configurable:!0,get:function(){return this.Ui},
set:function(a){null!==a&&A(a,"function",el,"memberValidation");this.Ui=a}},defaultScale:{configurable:!0,get:function(){return this.diagram.defaultScale},set:function(a){this.diagram.defaultScale=a}},zoomFactor:{configurable:!0,get:function(){return this.Nd},set:function(a){C(a,el,"zoomFactor");1<a||v("zoomFactor must be larger than 1.0, not: "+a);this.Nd=a}},isZoomToFitRestoreEnabled:{configurable:!0,get:function(){return this.Hc},set:function(a){A(a,"boolean",
el,"isZoomToFitRestoreEnabled");this.Hc=a}},scrollToPartPause:{configurable:!0,get:function(){return this.Wc},set:function(a){C(a,el,"scrollToPartPause");this.Wc=a}}});el.className="CommandHandler";Ji=function(){return new el};
function N(){fb(this);this.I=4225027;this.yb=1;this.Ag=null;this.Wa="";this.jc=this.pb=null;this.ra=(new J(NaN,NaN)).freeze();this.$c=cc;this.rg=Wb;this.qg=bc;this.tb=new Ib;this.ji=new Ib;this.og=new Ib;this.Fa=this.vl=1;this.dc=0;this.Le=il;this.uh=Ec;this.uc=(new L(NaN,NaN,NaN,NaN)).freeze();this.Cb=(new L(NaN,NaN,NaN,NaN)).freeze();this.vc=(new L(0,0,NaN,NaN)).freeze();this.S=this.Gp=this.Hp=null;this.el=this.Db=ld;this.Sp=0;this.Tp=1;this.dh=0;this.Ln=1;this.mq=null;this.Zp=-Infinity;this.hm=
0;this.im=Ob;this.jm=og;this.Ai="";this.kb=this.R=null;this.il=-1;this.lm=this.vd=this.zi=this.pm=null;this.dt=Mg;this.Vp=this.Yg=this.jk=null}var Hd,Mg,Og,il,jl,kl,ll,ml,nl,ol;
N.prototype.cloneProtected=function(a){a.I=this.I|6144;a.yb=this.yb;a.Wa=this.Wa;a.pb=this.pb;a.jc=this.jc;a.Yg=this.Yg;a.ra.assign(this.ra);a.$c=this.$c.J();a.rg=this.rg.J();a.qg=this.qg.J();a.og=this.og.copy();a.Fa=this.Fa;a.dc=this.dc;a.Le=this.Le;a.uh=this.uh.J();a.uc.assign(this.uc);a.Cb.assign(this.Cb);a.vc.assign(this.vc);a.Gp=this.Gp;null!==this.S&&(a.S=this.S.copy());a.Db=this.Db.J();a.el=this.el.J();a.Sp=this.Sp;a.Tp=this.Tp;a.dh=this.dh;a.Ln=this.Ln;a.mq=this.mq;a.Zp=this.Zp;a.hm=this.hm;
a.im=this.im.J();a.jm=this.jm;a.Ai=this.Ai;null!==this.R&&(a.R=this.R.copy());a.kb=this.kb;a.il=this.il;null!==this.zi&&(a.zi=Ia(this.zi));null!==this.vd&&(a.vd=this.vd.copy());a.lm=this.lm};N.prototype.hy=function(a){var b=this.zi;if(Ga(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.zi=b=[];b.push(a)};N.prototype.Kf=function(a){a.Hp=null;a.jk=null;a.v()};
N.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.zi)for(var b=0;b<this.zi.length;b++){var c=this.zi[b];a[c]=this[c]}return a};N.prototype.copy=function(){return this.clone()};t=N.prototype;t.nb=function(a){a.classType===R?0===a.name.indexOf("Orient")?this.segmentOrientation=a:v("Unknown Link enum value for GraphObject.segmentOrientation property: "+a):a.classType===N?this.stretch=a:Ba(this,a)};t.toString=function(){return Pa(this.constructor)+"#"+pb(this)};
function pl(a){null===a.R&&(a.R=new ql)}t.Pc=function(){if(null===this.S){var a=new rl;a.nh=Gc;a.Nh=Gc;a.lh=10;a.Lh=10;a.mh=0;a.Mh=0;this.S=a}};
t.hb=function(a,b,c,d,e,f,g){var h=this.part;if(null!==h&&(h.Uk(a,b,c,d,e,f,g),c===this&&a===He&&sl(this)&&tl(this,h,b),f=this.diagram,null===this.Yg||null===f||!f.Aj||f.undoManager.isUndoingRedoing||f.currentTool!==f.toolManager||f.animationManager.Fn||(a=this.Yg.get(b),null!==a&&f.animationManager.isEnabled&&!f.animationManager.isTicking&&(null===this.Vp&&(this.Vp=new Db),g=0===f.undoManager.transactionLevel,a.startCondition===ti?g=!0:a.startCondition===vi&&(g=!1),g?(f=new Dh,ui(a,f),g=this.Vp.get(a),
null!==g&&g.stop(),this.Vp.add(a,f),f.Kv=this,f.$x=a,f.add(this,b,d,e),f.start()):(Fh(f.animationManager,"Trigger"),f.animationManager.defaultAnimation.add(this,b,d,e)))),this instanceof V&&c===h&&0!==(h.I&16777216)&&null!==h.data))for(c=this.$.j,d=c.length,e=0;e<d;e++)h=c[e],h instanceof V&&Sj(h,function(a){null!==a.data&&0!==(a.I&16777216)&&a.Ha(b)})};
function tl(a,b,c){var d=a.tj();if(null!==d)for(var e=a.kb.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=ul(f,d,a);if(null===g)continue;f.Ar(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.Ar(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.Ar(a,h,c,d)}g===a&&(h=d.Ut(f.Hj),null!==h&&f.hx(h,g,c))}}t.Ut=function(a){return this.il===a?this:null};
t.g=function(a,b,c){this.hb(He,a,this,b,c)};function vl(a,b,c,d,e){var f=a.uc,g=a.og;g.reset();wl(a,g,b,c,d,e);a.og=g;f.h(b,c,d,e);g.gu()||g.bx(f)}function xl(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Rc(b,d):a.Uh(b,d)}
t.Ey=function(a,b,c){if(!1===this.pickable)return!1;var d=this.naturalBounds;b=a.Se(b);return c?Kb(a.x,a.y,0,0,0,d.height)<=b||Kb(a.x,a.y,0,d.height,d.width,d.height)<=b||Kb(a.x,a.y,d.width,d.height,d.width,0)<=b||Kb(a.x,a.y,d.width,0,0,0)<=b:a.qd(0,0)<=b&&a.qd(0,d.height)<=b&&a.qd(d.width,0)<=b&&a.qd(d.width,d.height)<=b};t.le=function(){return!0};
t.fa=function(a){F&&x(a,J,N,"containsPoint:p");var b=J.alloc();b.assign(a);this.transform.ya(b);var c=this.actualBounds;if(!c.o())return J.free(b),!1;var d=this.diagram;if(null!==d&&d.xe){var e=d.Lm("extraTouchThreshold"),f=d.Lm("extraTouchArea"),g=f/2,h=this.naturalBounds;d=this.Mf()*d.scale;var k=1/d;if(h.width*d<e&&h.height*d<e)return a=rc(c.x-g*k,c.y-g*k,c.width+f*k,c.height+f*k,b.x,b.y),J.free(b),a}e=!1;if(this instanceof Te||this instanceof Yf?rc(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y):
c.fa(b))this.vd&&!this.vd.fa(b)?e=!1:null!==this.jc&&c.fa(b)?e=!0:null!==this.pb&&this.vc.fa(a)?e=!0:e=this.Vh(a);J.free(b);return e};t.Vh=function(a){var b=this.naturalBounds;return rc(0,0,b.width,b.height,a.x,a.y)};
t.Qe=function(a){F&&x(a,L,N,"containsRect:r");if(0===this.angle)return this.actualBounds.Qe(a);var b=this.naturalBounds;b=L.allocAt(0,0,b.width,b.height);var c=this.transform,d=!1,e=J.allocAt(a.x,a.y);b.fa(c.ge(e))&&(e.h(a.x,a.bottom),b.fa(c.ge(e))&&(e.h(a.right,a.bottom),b.fa(c.ge(e))&&(e.h(a.right,a.y),b.fa(c.ge(e))&&(d=!0))));J.free(e);L.free(b);return d};
t.Uh=function(a,b){F&&x(a,L,N,"containedInRect:r");if(void 0===b)return a.Qe(this.actualBounds);var c=this.naturalBounds,d=!1,e=J.allocAt(0,0);a.fa(b.ya(e))&&(e.h(0,c.height),a.fa(b.ya(e))&&(e.h(c.width,c.height),a.fa(b.ya(e))&&(e.h(c.width,0),a.fa(b.ya(e))&&(d=!0))));J.free(e);return d};
t.Rc=function(a,b){F&&x(a,L,N,"intersectsRect:r");if(void 0===b&&(b=this.transform,0===this.angle))return a.Rc(this.actualBounds);var c=this.naturalBounds,d=J.allocAt(0,0),e=J.allocAt(0,c.height),f=J.allocAt(c.width,c.height),g=J.allocAt(c.width,0),h=!1;if(a.fa(b.ya(d))||a.fa(b.ya(e))||a.fa(b.ya(f))||a.fa(b.ya(g)))h=!0;else{c=L.allocAt(0,0,c.width,c.height);var k=J.allocAt(a.x,a.y);c.fa(b.ge(k))?h=!0:(k.h(a.x,a.bottom),c.fa(b.ge(k))?h=!0:(k.h(a.right,a.bottom),c.fa(b.ge(k))?h=!0:(k.h(a.right,a.y),
c.fa(b.ge(k))&&(h=!0))));J.free(k);L.free(c);!h&&(K.cu(a,d,e)||K.cu(a,e,f)||K.cu(a,f,g)||K.cu(a,g,d))&&(h=!0)}J.free(d);J.free(e);J.free(f);J.free(g);return h};t.ma=function(a,b){void 0===b&&(b=new J);if(a instanceof M){F&&a.Sb()&&v("getDocumentPoint:s Spot must be specific: "+a.toString());var c=this.naturalBounds;b.h(a.x*c.width+a.offsetX,a.y*c.height+a.offsetY)}else b.set(a);this.Gd.ya(b);return b};
t.Km=function(a){void 0===a&&(a=new L);var b=this.naturalBounds,c=this.Gd,d=J.allocAt(0,0).transform(c);a.h(d.x,d.y,0,0);d.h(b.width,0).transform(c);qc(a,d.x,d.y,0,0);d.h(b.width,b.height).transform(c);qc(a,d.x,d.y,0,0);d.h(0,b.height).transform(c);qc(a,d.x,d.y,0,0);J.free(d);return a};t.wj=function(){var a=this.Gd;1===a.m11&&0===a.m12?a=0:(a=180*Math.atan2(a.m12,a.m11)/Math.PI,0>a&&(a+=360));return a};
t.Mf=function(){if(0!==(this.I&4096)===!1)return this.vl;var a=this.Fa;return null!==this.panel?a*this.panel.Mf():a};t.$t=function(a,b){void 0===b&&(b=new J);b.assign(a);this.Gd.ge(b);return b};t.hd=function(a,b,c){return this.Hk(a.x,a.y,b.x,b.y,c)};
t.Hk=function(a,b,c,d,e){var f=this.transform,g=1/(f.m11*f.m22-f.m12*f.m21),h=f.m22*g,k=-f.m12*g,l=-f.m21*g,m=f.m11*g,n=g*(f.m21*f.dy-f.m22*f.dx),p=g*(f.m12*f.dx-f.m11*f.dy);if(null!==this.areaBackground)return f=this.actualBounds,K.hd(f.left,f.top,f.right,f.bottom,a,b,c,d,e);g=a*h+b*l+n;a=a*k+b*m+p;b=c*h+d*l+n;c=c*k+d*m+p;e.h(0,0);d=this.naturalBounds;c=K.hd(0,0,d.width,d.height,g,a,b,c,e);e.transform(f);return c};
N.prototype.measure=function(a,b,c,d){if(!1!==Fj(this)){var e=this.uh,f=e.right+e.left;e=e.top+e.bottom;a=Math.max(a-f,0);b=Math.max(b-e,0);c=Math.max((c||0)-f,0);d=Math.max((d||0)-e,0);f=this.angle;e=this.desiredSize;var g=0;this instanceof Yf&&(g=this.strokeWidth);90===f||270===f?(a=isFinite(e.height)?e.height+g:a,b=isFinite(e.width)?e.width+g:b):(a=isFinite(e.width)?e.width+g:a,b=isFinite(e.height)?e.height+g:b);e=c||0;g=d||0;var h=this instanceof V;switch(yl(this,!0)){case Mg:g=e=0;h&&(b=a=Infinity);
break;case Hd:isFinite(a)&&a>c&&(e=a);isFinite(b)&&b>d&&(g=b);break;case jl:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case kl:isFinite(b)&&b>d&&(g=b),e=0,h&&(a=Infinity)}h=this.maxSize;var k=this.minSize;e>h.width&&k.width<h.width&&(e=h.width);g>h.height&&k.height<h.height&&(g=h.height);c=Math.max(e/this.scale,k.width);d=Math.max(g/this.scale,k.height);h.width<c&&(c=Math.min(k.width,c));h.height<d&&(d=Math.min(k.height,d));a=Math.min(h.width,a);b=Math.min(h.height,b);a=Math.max(c,a);b=Math.max(d,
b);if(90===f||270===f)f=a,a=b,b=f,f=c,c=d,d=f;this.uc.ka();this.Rm(a,b,c,d);this.uc.freeze();this.uc.o()||v("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.uc.toString());Aj(this,!1)}};N.prototype.Rm=function(){};N.prototype.Qf=function(){return!1};
N.prototype.arrange=function(a,b,c,d,e){this.Ml();var f=L.alloc();f.assign(this.Cb);this.Cb.ka();!1===Gj(this)?this.Cb.h(a,b,c,d):this.Th(a,b,c,d);this.Cb.freeze();void 0===e?this.vd=null:this.vd=e;c=!1;if(void 0!==e)c=!0;else if(e=this.panel,null===e||e.type!==V.TableRow&&e.type!==V.TableColumn||(e=e.panel),null!==e&&(e=e.vc,d=this.measuredBounds,null!==this.areaBackground&&(d=this.Cb),c=b+d.height,d=a+d.width,c=!(0<=a+.05&&d<=e.width+.05&&0<=b+.05&&c<=e.height+.05),this instanceof ih&&(a=this.naturalBounds,
this.Js>a.height||this.xb>a.width)))c=!0;this.I=c?this.I|256:this.I&-257;this.Cb.o()||v("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.Cb.toString());this.pu(f,this.Cb);zl(this,!1);L.free(f)};t=N.prototype;t.Th=function(){};
function Al(a,b,c,d,e){a.Cb.h(b,c,d,e);if(!a.desiredSize.o()){var f=a.uc;c=a.uh;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=yl(a,!0);c===d&&f===e&&(b=Mg);switch(b){case Mg:if(c>d||f>e)Aj(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case Hd:Aj(a,!0);a.measure(d,e,0,0);break;case jl:Aj(a,!0);a.measure(d,f,0,0);break;case kl:Aj(a,!0),a.measure(c,e,0,0)}}}
t.pu=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||Bl(c,!0),this.P(),jc(a,b)||(c.Zh(),this.wp(c)))};t.wp=function(a){null!==this.portId&&(Bl(a,!0),a instanceof U&&Cl(a,this))};
t.hc=function(a,b){if(this.visible){var c=this instanceof V&&(this.type===V.TableRow||this.type===V.TableColumn),d=this.Cb;if(c||0!==d.width&&0!==d.height&&!isNaN(d.x)&&!isNaN(d.y)){var e=this.opacity;if(0!==e){var f=1;1!==e&&(f=a.globalAlpha,a.globalAlpha=f*e);if(!this.xy(a,b))if(c)Dl(this,a,b);else{this instanceof R&&this.Mk(!1);F&&F.Dm&&F.bA&&F.bA(a,this);c=this.transform;var g=this.panel;0!==(this.I&4096)===!0&&El(this);var h=this.part,k=!1,l=0;if(h&&b.Te("drawShadows")&&(k=h.isShadowed)){var m=
h.shadowOffset;l=Math.max(m.y,m.x)*b.scale*b.Yb}if(!(m=b.Ii||!this.Qf())){var n=this.naturalBounds;m=this.ji;var p=m.m11,r=m.m21,q=m.dx,u=m.m12,w=m.m22,y=m.dy,z,B=z=0;m=z*p+B*r+q;var D=z*u+B*w+y;z=n.width+l;B=0;var G=z*p+B*r+q;z=z*u+B*w+y;B=Math.min(m,G);var O=Math.min(D,z);var T=Math.max(m+0,G)-B;var P=Math.max(D+0,z)-O;m=B;D=O;z=n.width+l;B=n.height+l;G=z*p+B*r+q;z=z*u+B*w+y;B=Math.min(m,G);O=Math.min(D,z);T=Math.max(m+T,G)-B;P=Math.max(D+P,z)-O;m=B;D=O;z=0;B=n.height+l;G=z*p+B*r+q;z=z*u+B*w+y;
B=Math.min(m,G);O=Math.min(D,z);T=Math.max(m+T,G)-B;P=Math.max(D+P,z)-O;m=B;D=O;l=b.viewportBounds;n=l.x;p=l.y;m=!(m>l.width+n||n>T+m||D>l.height+p||p>P+D)}if(m){m=0!==(this.I&256);a.clipInsteadOfFill&&(m=!1);this instanceof ih&&(a.font=this.font);if(m){F&&F.dA&&Ca("clip"+this.toString());D=g.le()?g.naturalBounds:g.actualBounds;null!==this.vd?(n=this.vd,T=n.x,P=n.y,l=n.width,n=n.height):(T=Math.max(d.x,D.x),P=Math.max(d.y,D.y),l=Math.min(d.right,D.right)-T,n=Math.min(d.bottom,D.bottom)-P);if(T>d.width+
d.x||d.x>D.width+D.x){1!==e&&(a.globalAlpha=f);return}a.save();a.beginPath();a.rect(T,P,l,n);a.clip()}if(this.Qf()){if(!h.isVisible()){1!==e&&(a.globalAlpha=f);return}k&&(D=h.shadowOffset,a.Vw(D.x*b.scale*b.Yb,D.y*b.scale*b.Yb,h.shadowBlur),Fl(a),a.shadowColor=h.shadowColor)}!0===this.shadowVisible?Fl(a):!1===this.shadowVisible&&Gl(a);h=this.naturalBounds;null!==this.jc&&(zi(this,a,this.jc,!0,!0,h,d),this.jc instanceof Hl&&this.jc.type===Il?(a.beginPath(),a.rect(d.x,d.y,d.width,d.height),a.fe(this.jc)):
a.fillRect(d.x,d.y,d.width,d.height));a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy);k&&(null!==g&&0!==(g.I&512)||null!==g&&(g.type===V.Auto||g.type===V.Spot)&&g.ub()!==this)&&null===this.shadowVisible&&Gl(a);null!==this.pb&&(l=this.naturalBounds,T=D=0,P=l.width,l=l.height,n=0,this instanceof Yf&&(l=this.ua.bounds,D=l.x,T=l.y,P=l.width,l=l.height,n=this.strokeWidth),zi(this,a,this.pb,!0,!1,h,d),this.pb instanceof Hl&&this.pb.type===Il?(a.beginPath(),a.rect(D-n/2,T-n/2,P+n,l+n),a.fe(this.pb)):a.fillRect(D-
n/2,T-n/2,P+n,l+n));F&&F.Dm&&F.cA&&F.cA(a,this);k&&(null!==this.pb||null!==this.jc||null!==g&&0!==(g.I&512)||null!==g&&(g.type===V.Auto||g.type===V.Spot)&&g.ub()!==this)?(Jl(this,!0),null===this.shadowVisible&&Gl(a)):Jl(this,!1);this.pj(a,b);k&&0!==(this.I&512)===!0&&Fl(a);this.Qf()&&k&&Gl(a);m?(a.restore(),this instanceof V?a.zc(!0):a.zc(!1)):c.gu()||(b=1/(c.m11*c.m22-c.m12*c.m21),a.transform(c.m22*b,-c.m12*b,-c.m21*b,c.m11*b,b*(c.m21*c.dy-c.m22*c.dx),b*(c.m12*c.dx-c.m11*c.dy)))}}1!==e&&(a.globalAlpha=
f)}}}};t.xy=function(){return!1};function Dl(a,b,c){var d=a.Cb,e=a.vc;null!==a.jc&&(zi(a,b,a.jc,!0,!0,e,d),a.jc instanceof Hl&&a.jc.type===Il?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.fe(a.jc)):b.fillRect(d.x,d.y,d.width,d.height));null!==a.pb&&(zi(a,b,a.pb,!0,!1,e,d),a.pb instanceof Hl&&a.pb.type===Il?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.fe(a.pb)):b.fillRect(d.x,d.y,d.width,d.height));a.pj(b,c)}t.pj=function(){};
function zi(a,b,c,d,e,f,g){if(null!==c){var h=1,k=1;if("string"===typeof c)d?b.fillStyle=c:b.strokeStyle=c;else if(c.type===Kl)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{var l=0;a instanceof Yf&&(l=a.strokeWidth);h=f.width;k=f.height;e?(h=g.width,k=g.height):d||(h+=l,k+=l);if((f=b instanceof Ll)&&c.qe&&(c.type===Ml||c.ll===h&&c.Mu===k))var m=c.qe;else{var n=0,p=0,r=0,q=0,u=0,w=0;w=u=0;e?(u=g.x,w=g.y):d||(u-=l/2,w-=l/2);n=c.start.x*h+c.start.offsetX;p=c.start.y*k+c.start.offsetY;r=c.end.x*h+
c.end.offsetX;q=c.end.y*k+c.end.offsetY;n+=u;r+=u;p+=w;q+=w;if(c.type===Nl)m=b.createLinearGradient(n,p,r,q);else if(c.type===Il)w=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(u=0,w=Math.max(h,k)/2):u=c.startRadius,m=b.createRadialGradient(n,p,u,r,q,w);else if(c.type===Ml)try{m=b.createPattern(c.pattern,"repeat")}catch(z){m=null}else xa(c.type,"Brush type");if(c.type!==Ml&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)m.addColorStop(e.key,e.value);if(f&&(c.qe=m,null!==
m&&(c.ll=h,c.Mu=k),null===m&&c.type===Ml&&-1!==c.ll)){c.ll=-1;var y=a.diagram;null!==y&&-1===c.ll&&ta(function(){y.We()},600)}}d?b.fillStyle=m:b.strokeStyle=m}}}t.Sg=function(a){if(a instanceof V)a:{if(this!==a&&null!==a)for(var b=this.panel;null!==b;){if(b===a){a=!0;break a}b=b.panel}a=!1}else a=!1;return a};t.Rf=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.Rf():!0};
t.Tg=function(){for(var a=this instanceof V?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a};
function El(a){if(0!==(a.I&2048)===!0){var b=a.tb;b.reset();if(!a.Cb.o()||!a.uc.o()){Ol(a,!1);return}b.translate(a.Cb.x-a.uc.x,a.Cb.y-a.uc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;wl(a,b,c.x,c.y,c.width,c.height)}Ol(a,!1);Pl(a,!0)}0!==(a.I&4096)===!0&&(b=a.panel,null===b?(a.ji.set(a.tb),a.vl=a.scale,Pl(a,!1)):null!==b.Gd&&(c=a.ji,c.reset(),b.le()?c.multiply(b.ji):null!==b.panel&&c.multiply(b.panel.ji),c.multiply(a.tb),a.vl=a.scale*b.vl,Pl(a,!1)))}
function wl(a,b,c,d,e,f){1!==a.scale&&b.scale(a.scale);if(0!==a.dc){var g=Mc;a.Qf()&&a.locationSpot.cb()&&(g=a.locationSpot);var h=J.alloc();if(a instanceof S&&a.locationObject!==a)for(c=a.locationObject,d=c.naturalBounds,h.Wk(d.x,d.y,d.width,d.height,g),c.og.ya(h),h.offset(-c.measuredBounds.x,-c.measuredBounds.y),g=c.panel;null!==g&&g!==a;)g.og.ya(h),h.offset(-g.measuredBounds.x,-g.measuredBounds.y),g=g.panel;else h.Wk(c,d,e,f,g);b.rotate(a.dc,h.x,h.y);J.free(h)}}
t.v=function(a){void 0===a&&(a=!1);if(!0!==Fj(this)){Aj(this,!0);zl(this,!0);var b=this.panel;null===b||a||b.v()}};t.Nm=function(){!0!==Fj(this)&&(Aj(this,!0),zl(this,!0))};function Ql(a){if(!1===Gj(a)){var b=a.panel;null!==b?b.v():a.Qf()&&(b=a.diagram,null!==b&&(b.xd.add(a),a instanceof U&&a.sd(),b.Jb()));zl(a,!0)}}t.Ml=function(){0!==(this.I&2048)===!1&&(Ol(this,!0),Pl(this,!0))};t.rw=function(){Pl(this,!0)};t.P=function(){var a=this.part;null!==a&&a.P()};
function yl(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===V.Table)return Rl(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===V.Auto&&d.ub()===a)return Sl(a,Hd,b);if(c===il){if(null!==d){if(d.type===V.Spot&&d.ub()===a)return Sl(a,Hd,b);c=d.defaultStretch;return c===il?Sl(a,Mg,b):Sl(a,c,b)}return Sl(a,Mg,b)}return Sl(a,c,b)}
function Rl(a,b,c,d){var e=a.stretch;if(e!==il)return Sl(a,e,d);var f=e=null;switch(b.stretch){case kl:f=!0;break;case Hd:f=!0}switch(c.stretch){case jl:e=!0;break;case Hd:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===jl||b===Hd);null===f&&(f=b===kl||b===Hd);return!0===e&&!0===f?Sl(a,Hd,d):!0===e?Sl(a,jl,d):!0===f?Sl(a,kl,d):Sl(a,Mg,d)}
function Sl(a,b,c){if(c)return b;if(b===Mg)return Mg;c=a.desiredSize;if(c.o())return Mg;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===jl)return Mg;if(b===Hd)return kl}else{if(b===kl)return Mg;if(b===Hd)return jl}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===kl)return Mg;if(b===Hd)return jl}else{if(b===jl)return Mg;if(b===Hd)return kl}return b}function Jl(a,b){a.I=b?a.I|512:a.I&-513}function sl(a){return 0!==(a.I&1024)}function Tl(a,b){a.I=b?a.I|1024:a.I&-1025}
function Ol(a,b){a.I=b?a.I|2048:a.I&-2049}function Pl(a,b){a.I=b?a.I|4096:a.I&-4097}function Fj(a){return 0!==(a.I&8192)}function Aj(a,b){a.I=b?a.I|8192:a.I&-8193}function Gj(a){return 0!==(a.I&16384)}function zl(a,b){a.I=b?a.I|16384:a.I&-16385}t.Dj=function(a){this.Ag=a};t.yu=function(){};t.Rw=function(a){this.ra.assign(a);Ql(this);return!0};t.ur=function(a,b){if(this.ra.x!==a||this.ra.y!==b)this.ra.h(a,b),this.Ml()};
function Ul(a){var b=a.part;if(b instanceof U&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||Cl(b,a)}}function Vl(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof V?a instanceof U?a.sd():a.Yk(a,function(a){Ul(a)}):Ul(a))}t.bind=function(a){a.pd=this;var b=this.tj();null!==b&&Wl(b)&&v("Cannot add a Binding to a template that has already been copied: "+a);null===this.kb&&(this.kb=new H);this.kb.add(a)};
t.tj=function(){for(var a=this instanceof V?this:this.panel;null!==a;){if(null!==a.xi)return a;a=a.panel}return null};t.Sw=function(a){Mj(this,a)};function Xl(a,b){b.pd=a;null===a.Yg&&(a.Yg=new Db);a.Yg.add(b.propertyName,b)}
function Yl(a,b){for(var c=1;c<arguments.length;++c);c=arguments;var d=null,e=null;if("function"===typeof a)e=a;else if("string"===typeof a){var f=Zl.K(a);"function"===typeof f?(c=Ia(arguments),d=f(c),Fa(d)||v('GraphObject.make invoked object builder "'+a+'", but it did not return an Object')):e=qa.go[a]}null===d&&(void 0!==e&&null!==e&&e.constructor||v("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+a),d=new e);e=1;if(d instanceof Q&&1<c.length){f=
d;var g=c[1];if("string"===typeof g||g instanceof HTMLDivElement)Oi(f,g),e++}for(;e<c.length;e++)f=c[e],void 0===f?v("Undefined value at argument "+e+" for object being constructed by GraphObject.make: "+d):$l(d,f);return d}
function $l(a,b){if("string"===typeof b)if(a instanceof ih)a.text=b;else if(a instanceof Yf)a.figure=b;else if(a instanceof mk)a.source=b;else if(a instanceof V){var c=am.K(b);null!==c?a.type=c:F&&v("Unknown Panel type as an argument to GraphObject.make: "+b+". If building from source, you may need to call Panel.definePanelLayout.")}else a instanceof Hl?(c=gb(Hl,b),null!==c?a.type=c:v("Unknown Brush type as an argument to GraphObject.make: "+b)):a instanceof Fd?(c=gb(Fd,b),null!==c?a.type=c:F&&v("Unknown Geometry type as an argument to GraphObject.make: "+
b)):a instanceof ue?(c=gb(ue,b),null!==c?a.type=c:F&&v("Unknown PathSegment type as an argument to GraphObject.make: "+b)):F&&v("Unable to use a string as an argument to GraphObject.make: "+b);else if(b instanceof N)a instanceof V||v("A GraphObject can only be added to a Panel, not to: "+a),a.add(b);else if(b instanceof gk){var d;b.isRow&&"function"===typeof a.getRowDefinition?d=a.getRowDefinition(b.index):b.isRow||"function"!==typeof a.getColumnDefinition||(d=a.getColumnDefinition(b.index));d instanceof
gk?d.Qt(b):v("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+a)}else if(b instanceof E)"function"===typeof a.nb?a.nb(b):Ba(a,b);else if(b instanceof bm)a.type=b;else if(b instanceof Yi)a instanceof N?a.bind(b):a instanceof gk?a.bind(b):v("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+a);else if(b instanceof ri)a instanceof N?Xl(a,b):v("An AnimationTrigger can only be applied to a GraphObject, not to: "+
a);else if(b instanceof te)a instanceof Fd?a.figures.add(b):v("A PathFigure can only be added to a Geometry, not to: "+a);else if(b instanceof ue)a instanceof te?a.segments.add(b):v("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof Mi)a instanceof Q?a.layout=b:a instanceof Hf?a.layout=b:v("A Layout can only be assigned to a Diagram or a Group, not to: "+a);else if(Array.isArray(b))for(c=0;c<b.length;c++)$l(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof
Hl){c=new jb;for(var e in b)d=parseFloat(e),isNaN(d)?c[e]=b[e]:a.addColorStop(d,b[e]);Mj(a,c)}else if(a instanceof gk){void 0!==b.row?(e=b.row,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&v("Must specify non-negative integer row for RowColumnDefinition "+b+", not: "+e),a.isRow=!0,a.index=e):void 0!==b.column&&(e=b.column,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&v("Must specify non-negative integer column for RowColumnDefinition "+b+", not: "+e),a.isRow=!1,a.index=e);e=new jb;for(c in b)"row"!==
c&&"column"!==c&&(e[c]=b[c]);Mj(a,e)}else Mj(a,b);else v('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+a)}function cm(a,b){A(a,"string",N,"defineBuilder:name");A(b,"function",N,"defineBuilder:func");var c=a.toLowerCase();F&&(""===a||"none"===c||a===c)&&v("Shape.defineFigureGenerator name must not be empty or None or all-lower-case: "+a);Zl.add(a,b)}
function dm(a,b,c){void 0===c&&(c=null);var d=a[1];if("function"===typeof c?c(d):"string"===typeof d)return a.splice(1,1),d;if(void 0===b)throw Error("no "+("function"===typeof c?"satisfactory":"string")+" argument for GraphObject builder "+a[0]);return b}
ma.Object.defineProperties(N.prototype,{shadowVisible:{configurable:!0,get:function(){return this.lm},set:function(a){var b=this.lm;b!==a&&(F&&null!==a&&A(a,"boolean",N,"shadowVisible"),this.lm=a,this.P(),this.g("shadowVisible",b,a))}},enabledChanged:{configurable:!0,get:function(){return null!==this.R?this.R.jo:null},set:function(a){pl(this);var b=this.R.jo;b!==a&&(null!==a&&A(a,"function",N,"enabledChanged"),this.R.jo=a,this.g("enabledChanged",b,a))}},segmentOrientation:{configurable:!0,
enumerable:!0,get:function(){return this.jm},set:function(a){var b=this.jm;b!==a&&(F&&hb(a,R,N,"segmentOrientation"),this.jm=a,this.v(),this.g("segmentOrientation",b,a),a===og&&(this.angle=0))}},segmentIndex:{configurable:!0,get:function(){return this.Zp},set:function(a){F&&A(a,"number",N,"segmentIndex");a=Math.round(a);var b=this.Zp;b!==a&&(this.Zp=a,this.v(),this.g("segmentIndex",b,a))}},segmentFraction:{configurable:!0,get:function(){return this.hm},set:function(a){F&&
A(a,"number",N,"segmentFraction");isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.hm;b!==a&&(this.hm=a,this.v(),this.g("segmentFraction",b,a))}},segmentOffset:{configurable:!0,get:function(){return this.im},set:function(a){var b=this.im;b.A(a)||(F&&x(a,J,N,"segmentOffset"),this.im=a=a.J(),this.v(),this.g("segmentOffset",b,a))}},stretch:{configurable:!0,get:function(){return this.Le},set:function(a){var b=this.Le;b!==a&&(F&&hb(a,N,N,"stretch"),this.Le=a,this.v(),this.g("stretch",
b,a))}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){var b=this.Wa;b!==a&&(F&&A(a,"string",N,"name"),this.Wa=a,null!==this.part&&(this.part.fk=null),this.g("name",b,a))}},opacity:{configurable:!0,get:function(){return this.yb},set:function(a){var b=this.yb;b!==a&&(A(a,"number",N,"opacity"),(0>a||1<a)&&ya(a,"0 <= value <= 1",N,"opacity"),this.yb=a,this.g("opacity",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.P(Qj(b,b.actualBounds)))}},visible:{configurable:!0,
enumerable:!0,get:function(){return 0!==(this.I&1)},set:function(a){var b=0!==(this.I&1);b!==a&&(F&&A(a,"boolean",N,"visible"),this.I^=1,this.g("visible",b,a),b=this.panel,null!==b?b.v():this.Qf()&&this.Ub(a),this.P(),Vl(this))}},pickable:{configurable:!0,get:function(){return 0!==(this.I&2)},set:function(a){var b=0!==(this.I&2);b!==a&&(F&&A(a,"boolean",N,"pickable"),this.I^=2,this.g("pickable",b,a))}},fromLinkableDuplicates:{configurable:!0,get:function(){return 0!==(this.I&
4)},set:function(a){var b=0!==(this.I&4);b!==a&&(F&&A(a,"boolean",N,"fromLinkableDuplicates"),this.I^=4,this.g("fromLinkableDuplicates",b,a))}},fromLinkableSelfNode:{configurable:!0,get:function(){return 0!==(this.I&8)},set:function(a){var b=0!==(this.I&8);b!==a&&(F&&A(a,"boolean",N,"fromLinkableSelfNode"),this.I^=8,this.g("fromLinkableSelfNode",b,a))}},toLinkableDuplicates:{configurable:!0,get:function(){return 0!==(this.I&16)},set:function(a){var b=0!==(this.I&16);b!==
a&&(F&&A(a,"boolean",N,"toLinkableDuplicates"),this.I^=16,this.g("toLinkableDuplicates",b,a))}},toLinkableSelfNode:{configurable:!0,get:function(){return 0!==(this.I&32)},set:function(a){var b=0!==(this.I&32);b!==a&&(F&&A(a,"boolean",N,"toLinkableSelfNode"),this.I^=32,this.g("toLinkableSelfNode",b,a))}},isPanelMain:{configurable:!0,get:function(){return 0!==(this.I&64)},set:function(a){var b=0!==(this.I&64);b!==a&&(F&&A(a,"boolean",N,"isPanelMain"),this.I^=64,this.v(),
this.g("isPanelMain",b,a))}},isActionable:{configurable:!0,get:function(){return 0!==(this.I&128)},set:function(a){var b=0!==(this.I&128);b!==a&&(F&&A(a,"boolean",N,"isActionable"),this.I^=128,this.g("isActionable",b,a))}},areaBackground:{configurable:!0,get:function(){return this.jc},set:function(a){var b=this.jc;b!==a&&(null!==a&&em(a,"GraphObject.areaBackground"),a instanceof Hl&&a.freeze(),this.jc=a,this.P(),this.g("areaBackground",b,a))}},background:{configurable:!0,
enumerable:!0,get:function(){return this.pb},set:function(a){var b=this.pb;b!==a&&(null!==a&&em(a,"GraphObject.background"),a instanceof Hl&&a.freeze(),this.pb=a,this.P(),this.g("background",b,a))}},part:{configurable:!0,get:function(){if(this.Qf())return this;if(null!==this.jk)return this.jk;var a;for(a=this.panel;a;){if(a instanceof S)return this.jk=a;a=a.panel}return null}},svg:{configurable:!0,get:function(){return this.rq},set:function(a){this.rq=a}},panel:{configurable:!0,
enumerable:!0,get:function(){return this.Ag}},layer:{configurable:!0,get:function(){var a=this.part;return null!==a?a.layer:null}},diagram:{configurable:!0,get:function(){var a=this.part;return null!==a?a.diagram:null}},position:{configurable:!0,get:function(){return this.ra},set:function(a){F&&x(a,J,N,"position");var b=a.x,c=a.y,d=this.ra,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))?this.yu():(a=a.copy(),this.Rw(a,d)&&this.g("position",
d.copy(),a.copy()))}},actualBounds:{configurable:!0,get:function(){return this.Cb}},scale:{configurable:!0,get:function(){return this.Fa},set:function(a){var b=this.Fa;b!==a&&(F&&C(a,N,"scale"),0>=a&&v("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.Fa=a,this.v(),this.g("scale",b,a))}},angle:{configurable:!0,get:function(){return this.dc},set:function(a){var b=this.dc;b!==a&&(F&&C(a,N,"angle"),a%=360,0>a&&(a+=360),b!==a&&(this.dc=
a,Vl(this),this.v(),this.g("angle",b,a)))}},desiredSize:{configurable:!0,get:function(){return this.$c},set:function(a){F&&x(a,Hb,N,"desiredSize");var b=a.width,c=a.height,d=this.$c,e=d.width,f=d.height;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.$c=a=a.J(),this.v(),this instanceof Yf&&this.ic(),this.g("desiredSize",d,a),sl(this)&&(a=this.part,null!==a&&(tl(this,a,"width"),tl(this,a,"height"))))}},width:{configurable:!0,get:function(){return this.$c.width},
set:function(a){var b=this.$c.width;b===a||isNaN(b)&&isNaN(a)||(F&&A(a,"number",N,"width"),b=this.$c,this.$c=a=(new Hb(a,this.$c.height)).freeze(),this.v(),this instanceof Yf&&this.ic(),this.g("desiredSize",b,a),sl(this)&&(a=this.part,null!==a&&tl(this,a,"width")))}},height:{configurable:!0,get:function(){return this.$c.height},set:function(a){var b=this.$c.height;b===a||isNaN(b)&&isNaN(a)||(F&&A(a,"number",N,"height"),b=this.$c,this.$c=a=(new Hb(this.$c.width,a)).freeze(),this.v(),
this instanceof Yf&&this.ic(),this.g("desiredSize",b,a),sl(this)&&(a=this.part,null!==a&&tl(this,a,"height")))}},minSize:{configurable:!0,get:function(){return this.rg},set:function(a){var b=this.rg;b.A(a)||(F&&x(a,Hb,N,"minSize"),a=a.copy(),isNaN(a.width)&&(a.width=0),isNaN(a.height)&&(a.height=0),a.freeze(),this.rg=a,this.v(),this.g("minSize",b,a))}},maxSize:{configurable:!0,get:function(){return this.qg},set:function(a){var b=this.qg;b.A(a)||(F&&x(a,Hb,N,"maxSize"),
a=a.copy(),isNaN(a.width)&&(a.width=Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.qg=a,this.v(),this.g("maxSize",b,a))}},measuredBounds:{configurable:!0,get:function(){return this.uc}},naturalBounds:{configurable:!0,get:function(){return this.vc}},margin:{configurable:!0,get:function(){return this.uh},set:function(a){"number"===typeof a?a=new lc(a):F&&x(a,lc,N,"margin");var b=this.uh;b.A(a)||(this.uh=a=a.J(),this.v(),this.g("margin",b,a))}},
transform:{configurable:!0,get:function(){0!==(this.I&2048)===!0&&El(this);return this.tb}},Gd:{configurable:!0,get:function(){0!==(this.I&4096)===!0&&El(this);return this.ji}},alignment:{configurable:!0,get:function(){return this.Db},set:function(a){var b=this.Db;b.A(a)||(F&&x(a,M,N,"alignment"),a.Sb()&&!a.Ib()&&v("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+a),this.Db=a=a.J(),Ql(this),this.g("alignment",b,a))}},column:{configurable:!0,
enumerable:!0,get:function(){return this.dh},set:function(a){F&&C(a,N,"column");a=Math.round(a);var b=this.dh;b!==a&&(0>a&&ya(a,">= 0",N,"column"),this.dh=a,this.v(),this.g("column",b,a))}},columnSpan:{configurable:!0,get:function(){return this.Ln},set:function(a){F&&A(a,"number",N,"columnSpan");a=Math.round(a);var b=this.Ln;b!==a&&(1>a&&ya(a,">= 1",N,"columnSpan"),this.Ln=a,this.v(),this.g("columnSpan",b,a))}},row:{configurable:!0,get:function(){return this.Sp},set:function(a){F&&
C(a,N,"row");a=Math.round(a);var b=this.Sp;b!==a&&(0>a&&ya(a,">= 0",N,"row"),this.Sp=a,this.v(),this.g("row",b,a))}},rowSpan:{configurable:!0,get:function(){return this.Tp},set:function(a){F&&A(a,"number",N,"rowSpan");a=Math.round(a);var b=this.Tp;b!==a&&(1>a&&ya(a,">= 1",N,"rowSpan"),this.Tp=a,this.v(),this.g("rowSpan",b,a))}},spanAllocation:{configurable:!0,get:function(){return this.mq},set:function(a){var b=this.mq;b!==a&&(null!==a&&A(a,"function",N,"spanAllocation"),
this.mq=a,this.v(),this.g("spanAllocation",b,a))}},alignmentFocus:{configurable:!0,get:function(){return this.el},set:function(a){var b=this.el;b.A(a)||(F&&x(a,M,N,"alignmentFocus"),!F||!a.Sb()||a.Ib()||a.ar()&&this instanceof U||v("GraphObject.alignmentFocus must be a real Spot or Spot.Default, not: "+a),this.el=a=a.J(),this.v(),this.g("alignmentFocus",b,a))}},portId:{configurable:!0,get:function(){return this.Gp},set:function(a){var b=this.Gp;if(b!==a){F&&null!==a&&A(a,
"string",N,"portId");var c=this.part;null===c||c instanceof U||(v("Cannot set portID on a Link: "+a),c=null);null!==b&&null!==c&&fm(c,this);this.Gp=a;null!==a&&null!==c&&(c.Yh=!0,gm(c,this));this.g("portId",b,a)}}},toSpot:{configurable:!0,get:function(){return null!==this.S?this.S.Nh:Gc},set:function(a){this.Pc();var b=this.S.Nh;b.A(a)||(F&&x(a,M,N,"toSpot"),a=a.J(),this.S.Nh=a,this.g("toSpot",b,a),Ul(this))}},toEndSegmentLength:{configurable:!0,get:function(){return null!==
this.S?this.S.Lh:10},set:function(a){this.Pc();var b=this.S.Lh;b!==a&&(F&&A(a,"number",N,"toEndSegmentLength"),0>a&&ya(a,">= 0",N,"toEndSegmentLength"),this.S.Lh=a,this.g("toEndSegmentLength",b,a),Ul(this))}},toShortLength:{configurable:!0,get:function(){return null!==this.S?this.S.Mh:0},set:function(a){this.Pc();var b=this.S.Mh;b!==a&&(F&&A(a,"number",N,"toShortLength"),this.S.Mh=a,this.g("toShortLength",b,a),Ul(this))}},toLinkable:{configurable:!0,get:function(){return null!==
this.S?this.S.vq:null},set:function(a){this.Pc();var b=this.S.vq;b!==a&&(F&&null!==a&&A(a,"boolean",N,"toLinkable"),this.S.vq=a,this.g("toLinkable",b,a))}},toMaxLinks:{configurable:!0,get:function(){return null!==this.S?this.S.wq:Infinity},set:function(a){this.Pc();var b=this.S.wq;b!==a&&(F&&A(a,"number",N,"toMaxLinks"),0>a&&ya(a,">= 0",N,"toMaxLinks"),this.S.wq=a,this.g("toMaxLinks",b,a))}},fromSpot:{configurable:!0,get:function(){return null!==this.S?this.S.nh:Gc},set:function(a){this.Pc();
var b=this.S.nh;b.A(a)||(F&&x(a,M,N,"fromSpot"),a=a.J(),this.S.nh=a,this.g("fromSpot",b,a),Ul(this))}},fromEndSegmentLength:{configurable:!0,get:function(){return null!==this.S?this.S.lh:10},set:function(a){this.Pc();var b=this.S.lh;b!==a&&(F&&A(a,"number",N,"fromEndSegmentLength"),0>a&&ya(a,">= 0",N,"fromEndSegmentLength"),this.S.lh=a,this.g("fromEndSegmentLength",b,a),Ul(this))}},fromShortLength:{configurable:!0,get:function(){return null!==this.S?this.S.mh:0},set:function(a){this.Pc();
var b=this.S.mh;b!==a&&(F&&A(a,"number",N,"fromShortLength"),this.S.mh=a,this.g("fromShortLength",b,a),Ul(this))}},fromLinkable:{configurable:!0,get:function(){return null!==this.S?this.S.qo:null},set:function(a){this.Pc();var b=this.S.qo;b!==a&&(F&&null!==a&&A(a,"boolean",N,"fromLinkable"),this.S.qo=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{configurable:!0,get:function(){return null!==this.S?this.S.ro:Infinity},set:function(a){this.Pc();var b=this.S.ro;b!==a&&(F&&
A(a,"number",N,"fromMaxLinks"),0>a&&ya(a,">= 0",N,"fromMaxLinks"),this.S.ro=a,this.g("fromMaxLinks",b,a))}},cursor:{configurable:!0,get:function(){return this.Ai},set:function(a){var b=this.Ai;b!==a&&(A(a,"string",N,"cursor"),this.Ai=a,this.g("cursor",b,a))}},click:{configurable:!0,get:function(){return null!==this.R?this.R.$f:null},set:function(a){pl(this);var b=this.R.$f;b!==a&&(null!==a&&A(a,"function",N,"click"),this.R.$f=a,this.g("click",b,a))}},doubleClick:{configurable:!0,
enumerable:!0,get:function(){return null!==this.R?this.R.eg:null},set:function(a){pl(this);var b=this.R.eg;b!==a&&(null!==a&&A(a,"function",N,"doubleClick"),this.R.eg=a,this.g("doubleClick",b,a))}},contextClick:{configurable:!0,get:function(){return null!==this.R?this.R.ag:null},set:function(a){pl(this);var b=this.R.ag;b!==a&&(null!==a&&A(a,"function",N,"contextClick"),this.R.ag=a,this.g("contextClick",b,a))}},mouseEnter:{configurable:!0,get:function(){return null!==this.R?
this.R.tg:null},set:function(a){pl(this);var b=this.R.tg;b!==a&&(null!==a&&A(a,"function",N,"mouseEnter"),this.R.tg=a,this.g("mouseEnter",b,a))}},mouseLeave:{configurable:!0,get:function(){return null!==this.R?this.R.wg:null},set:function(a){pl(this);var b=this.R.wg;b!==a&&(null!==a&&A(a,"function",N,"mouseLeave"),this.R.wg=a,this.g("mouseLeave",b,a))}},mouseOver:{configurable:!0,get:function(){return null!==this.R?this.R.xg:null},set:function(a){pl(this);var b=this.R.xg;
b!==a&&(null!==a&&A(a,"function",N,"mouseOver"),this.R.xg=a,this.g("mouseOver",b,a))}},mouseHover:{configurable:!0,get:function(){return null!==this.R?this.R.vg:null},set:function(a){pl(this);var b=this.R.vg;b!==a&&(null!==a&&A(a,"function",N,"mouseHover"),this.R.vg=a,this.g("mouseHover",b,a))}},mouseHold:{configurable:!0,get:function(){return null!==this.R?this.R.ug:null},set:function(a){pl(this);var b=this.R.ug;b!==a&&(null!==a&&A(a,"function",N,"mouseHold"),this.R.ug=
a,this.g("mouseHold",b,a))}},mouseDragEnter:{configurable:!0,get:function(){return null!==this.R?this.R.jp:null},set:function(a){pl(this);var b=this.R.jp;b!==a&&(null!==a&&A(a,"function",N,"mouseDragEnter"),this.R.jp=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{configurable:!0,get:function(){return null!==this.R?this.R.kp:null},set:function(a){pl(this);var b=this.R.kp;b!==a&&(null!==a&&A(a,"function",N,"mouseDragLeave"),this.R.kp=a,this.g("mouseDragLeave",b,a))}},
mouseDrop:{configurable:!0,get:function(){return null!==this.R?this.R.sg:null},set:function(a){pl(this);var b=this.R.sg;b!==a&&(null!==a&&A(a,"function",N,"mouseDrop"),this.R.sg=a,this.g("mouseDrop",b,a))}},actionDown:{configurable:!0,get:function(){return null!==this.R?this.R.sn:null},set:function(a){pl(this);var b=this.R.sn;b!==a&&(null!==a&&A(a,"function",N,"actionDown"),this.R.sn=a,this.g("actionDown",b,a))}},actionMove:{configurable:!0,get:function(){return null!==
this.R?this.R.tn:null},set:function(a){pl(this);var b=this.R.tn;b!==a&&(null!==a&&A(a,"function",N,"actionMove"),this.R.tn=a,this.g("actionMove",b,a))}},actionUp:{configurable:!0,get:function(){return null!==this.R?this.R.un:null},set:function(a){pl(this);var b=this.R.un;b!==a&&(null!==a&&A(a,"function",N,"actionUp"),this.R.un=a,this.g("actionUp",b,a))}},actionCancel:{configurable:!0,get:function(){return null!==this.R?this.R.rn:null},set:function(a){pl(this);var b=this.R.rn;
b!==a&&(null!==a&&A(a,"function",N,"actionCancel"),this.R.rn=a,this.g("actionCancel",b,a))}},toolTip:{configurable:!0,get:function(){return null!==this.R?this.R.Ig:null},set:function(a){pl(this);var b=this.R.Ig;b!==a&&(!F||null===a||a instanceof Te||a instanceof bf||v("GraphObject.toolTip must be an Adornment or HTMLInfo."),this.R.Ig=a,this.g("toolTip",b,a))}},contextMenu:{configurable:!0,get:function(){return null!==this.R?this.R.bg:null},set:function(a){pl(this);var b=
this.R.bg;b!==a&&(!F||a instanceof Te||a instanceof bf||v("GraphObject.contextMenu must be an Adornment or HTMLInfo."),this.R.bg=a,this.g("contextMenu",b,a))}}});N.prototype.setProperties=N.prototype.Sw;N.prototype.findTemplateBinder=N.prototype.tj;N.prototype.bind=N.prototype.bind;N.prototype.isEnabledObject=N.prototype.Tg;N.prototype.isVisibleObject=N.prototype.Rf;N.prototype.isContainedBy=N.prototype.Sg;N.prototype.getNearestIntersectionPoint=N.prototype.hd;N.prototype.getLocalPoint=N.prototype.$t;
N.prototype.getDocumentScale=N.prototype.Mf;N.prototype.getDocumentAngle=N.prototype.wj;N.prototype.getDocumentBounds=N.prototype.Km;N.prototype.getDocumentPoint=N.prototype.ma;N.prototype.intersectsRect=N.prototype.Rc;N.prototype.containedInRect=N.prototype.Uh;N.prototype.containsRect=N.prototype.Qe;N.prototype.containsPoint=N.prototype.fa;N.prototype.raiseChanged=N.prototype.g;N.prototype.raiseChangedEvent=N.prototype.hb;N.prototype.addCopyProperty=N.prototype.hy;var Zl=null;N.className="GraphObject";
Zl=new Db;
cm("Button",function(){function a(a,b){return null!==a.diagram.$b(a.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a},function(a){return a===b})}var b=Yl(V,V.Auto,{isActionable:!0,enabledChanged:function(a,b){if(a instanceof V){var c=a.gb("ButtonBorder");null!==c&&(c.fill=b?a._buttonFillNormal:a._buttonFillDisabled)}},cursor:"pointer",_buttonFillNormal:"#F5F5F5",_buttonStrokeNormal:"#BDBDBD",_buttonFillOver:"#E0E0E0",_buttonStrokeOver:"#9E9E9E",_buttonFillPressed:"#BDBDBD",_buttonStrokePressed:"#9E9E9E",
_buttonFillDisabled:"#E5E5E5"},Yl(Yf,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new M(0,0,2.76142374915397,2.761423749153969),spot2:new M(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));b.mouseEnter=function(a,b){if(b.Tg()&&b instanceof V&&(a=b.gb("ButtonBorder"),a instanceof Yf)){var c=b._buttonFillOver;b._buttonFillNormal=a.fill;a.fill=c;c=b._buttonStrokeOver;b._buttonStrokeNormal=a.stroke;a.stroke=c}};b.mouseLeave=function(a,b){b.Tg()&&
b instanceof V&&(a=b.gb("ButtonBorder"),a instanceof Yf&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.Tg()&&b instanceof V&&null!==b._buttonFillPressed&&0===a.button){var c=b.gb("ButtonBorder");if(c instanceof Yf){a=a.diagram;var d=a.skipsUndoManager;a.skipsUndoManager=!0;var g=b._buttonFillPressed;b._buttonFillOver=c.fill;c.fill=g;g=b._buttonStrokePressed;b._buttonStrokeOver=c.stroke;c.stroke=g;a.skipsUndoManager=d}}};b.actionUp=function(b,d){if(d.Tg()&&
d instanceof V&&null!==d._buttonFillPressed&&0===b.button){var c=d.gb("ButtonBorder");if(c instanceof Yf){var f=b.diagram,g=f.skipsUndoManager;f.skipsUndoManager=!0;a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionCancel=function(b,d){if(d.Tg()&&d instanceof V&&null!==d._buttonFillPressed){var c=d.gb("ButtonBorder");if(c instanceof Yf){var f=b.diagram,g=f.skipsUndoManager;f.skipsUndoManager=!0;
a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionMove=function(b,d){if(d.Tg()&&d instanceof V&&null!==d._buttonFillPressed){var c=b.diagram;if(0===c.firstInput.button&&(c.currentTool.standardMouseOver(),a(b,d)&&(b=d.gb("ButtonBorder"),b instanceof Yf))){var f=c.skipsUndoManager;c.skipsUndoManager=!0;var g=d._buttonFillPressed;b.fill!==g&&(b.fill=g);g=d._buttonStrokePressed;b.stroke!==g&&(b.stroke=
g);c.skipsUndoManager=f}}};return b});
cm("TreeExpanderButton",function(){var a=Yl("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},Yl(Yf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:$b},(new Yi("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).hr()),{visible:!1},(new Yi("visible","isTreeLeaf",function(a){return!a})).hr());a.click=function(a,c){c=c.part;c instanceof Te&&(c=c.adornedPart);if(c instanceof U){var b=c.diagram;
if(null!==b){b=b.commandHandler;if(c.isTreeExpanded){if(!b.canCollapseTree(c))return}else if(!b.canExpandTree(c))return;a.handled=!0;c.isTreeExpanded?b.collapseTree(c):b.expandTree(c)}}};return a});
cm("SubGraphExpanderButton",function(){var a=Yl("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},Yl(Yf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:$b},(new Yi("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).hr()));a.click=function(a,c){c=c.part;c instanceof Te&&(c=c.adornedPart);if(c instanceof Hf){var b=c.diagram;if(null!==b){b=b.commandHandler;if(c.isSubGraphExpanded){if(!b.canCollapseSubGraph(c))return}else if(!b.canExpandSubGraph(c))return;
a.handled=!0;c.isSubGraphExpanded?b.collapseSubGraph(c):b.expandSubGraph(c)}}};return a});cm("ToolTip",function(){return Yl(Te,V.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},Yl(Yf,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new M(0,0,4,6),spot2:new M(1,1,-4,-4)}))});
cm("ContextMenu",function(){return Yl(Te,V.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},new Yi("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});cm("ContextMenuButton",function(){var a=Yl("Button");a.stretch=jl;var b=a.gb("ButtonBorder");b instanceof Yf&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new M(0,0,2,3),b.spot2=new M(1,1,-2,-2));return a});
cm("PanelExpanderButton",function(a){var b=dm(a,"COLLAPSIBLE"),c=Yl("Button",{_buttonExpandedFigure:"M0 0 M0 6 L4 2 8 6 M8 8",_buttonCollapsedFigure:"M0 0 M0 2 L4 6 8 2 M8 8",_buttonFillNormal:"rgba(0, 0, 0, 0)",_buttonStrokeNormal:null,_buttonFillOver:"rgba(0, 0, 0, .2)",_buttonStrokeOver:null,_buttonFillPressed:"rgba(0, 0, 0, .4)",_buttonStrokePressed:null},Yl(Yf,{name:"ButtonIcon",strokeWidth:2},(new Yi("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).hr(b)));
a=c.gb("ButtonBorder");a instanceof Yf&&(a.stroke=null,a.fill="rgba(0, 0, 0, 0)");c.click=function(a,c){var d=c.diagram;if(null!==d&&!d.isReadOnly){var e=c.tj();null===e&&(e=c.part);null!==e&&(c=e.gb(b),null!==c&&(a.handled=!0,d.Ca("Collapse/Expand Panel"),c.visible=!c.visible,d.bb("Collapse/Expand Panel")))}};return c});
cm("CheckBoxButton",function(a){var b=dm(a);a=Yl("Button",{desiredSize:new Hb(14,14)},Yl(Yf,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:Hd,geometryStretch:Og,visible:!1},""!==b?(new Yi("visible",b)).Vy():[]));a.click=function(a,d){if(d instanceof V){var c=a.diagram;if(!(null===c||c.isReadOnly||""!==b&&c.model.isReadOnly)){a.handled=!0;var f=d.gb("ButtonIcon");c.Ca("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a,
d);c.bb("checkbox")}}};return a});
cm("CheckBox",function(a){a=dm(a);a=Yl("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new lc(0,1,0,0)});var b=Yl(V,"Horizontal",a,{isActionable:!0,cursor:a.cursor,margin:1,_buttonFillNormal:a._buttonFillNormal,_buttonStrokeNormal:a._buttonStrokeNormal,_buttonFillOver:a._buttonFillOver,_buttonStrokeOver:a._buttonStrokeOver,_buttonFillPressed:a._buttonFillPressed,_buttonStrokePressed:a._buttonStrokePressed,_buttonFillDisabled:a._buttonFillDisabled,mouseEnter:a.mouseEnter,mouseLeave:a.mouseLeave,
actionDown:a.actionDown,actionUp:a.actionUp,actionCancel:a.actionCancel,actionMove:a.actionMove,click:a.click,_buttonClick:a.click});a.mouseEnter=null;a.mouseLeave=null;a.actionDown=null;a.actionUp=null;a.actionCancel=null;a.actionMove=null;a.click=null;return b});N.None=Mg=new E(N,"None",0);N.Default=il=new E(N,"Default",0);N.Vertical=kl=new E(N,"Vertical",4);N.Horizontal=jl=new E(N,"Horizontal",5);N.Fill=Hd=new E(N,"Fill",3);N.Uniform=Og=new E(N,"Uniform",1);
N.UniformToFill=ll=new E(N,"UniformToFill",2);N.FlipVertical=ml=new E(N,"FlipVertical",1);N.FlipHorizontal=nl=new E(N,"FlipHorizontal",2);N.FlipBoth=ol=new E(N,"FlipBoth",3);N.make=Yl;N.getBuilders=function(){var a=new Db,b;for(b in Zl)if(b!==b.toLowerCase()){var c=Zl.K(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};N.defineBuilder=cm;N.takeBuilderArgument=dm;
function ql(){this.jo=this.bg=this.Ig=this.rn=this.un=this.tn=this.sn=this.sg=this.kp=this.jp=this.ug=this.vg=this.xg=this.wg=this.tg=this.ag=this.eg=this.$f=null}ql.prototype.copy=function(){var a=new ql;a.$f=this.$f;a.eg=this.eg;a.ag=this.ag;a.tg=this.tg;a.wg=this.wg;a.xg=this.xg;a.vg=this.vg;a.ug=this.ug;a.jp=this.jp;a.kp=this.kp;a.sg=this.sg;a.sn=this.sn;a.tn=this.tn;a.un=this.un;a.rn=this.rn;a.Ig=this.Ig;a.bg=this.bg;a.jo=this.jo;return a};ql.className="GraphObjectEventHandlers";
function hm(){this.Sa=[1,0,0,1,0,0]}hm.prototype.copy=function(){var a=new hm;a.Sa[0]=this.Sa[0];a.Sa[1]=this.Sa[1];a.Sa[2]=this.Sa[2];a.Sa[3]=this.Sa[3];a.Sa[4]=this.Sa[4];a.Sa[5]=this.Sa[5];return a};hm.prototype.translate=function(a,b){this.Sa[4]+=this.Sa[0]*a+this.Sa[2]*b;this.Sa[5]+=this.Sa[1]*a+this.Sa[3]*b};hm.prototype.scale=function(a,b){this.Sa[0]*=a;this.Sa[1]*=a;this.Sa[2]*=b;this.Sa[3]*=b};hm.className="STransform";
function im(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.py=[];this.pattern=null}im.prototype.addColorStop=function(a,b){this.py.push({offset:a,color:b})};im.className="SGradient";
function Pj(a,b){this.ownerDocument=a=void 0===b?qa.document:b;this.aB="http://www.w3.org/2000/svg";void 0!==a&&(this.La=this.Bb("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.La.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.La.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"));this.Oq=null;this.context=new jm(this)}
Pj.prototype.resize=function(a,b,c,d){return this.width!==a||this.height!==b?(this.style.width=c+"px",this.style.height=d+"px",this.La.setAttributeNS(null,"width",c+"px"),this.La.setAttributeNS(null,"height",d+"px"),this.La.setAttributeNS(null,"viewBox","0 0 "+c+" "+d),this.context.pv.firstElementChild.setAttributeNS(null,"width",c+"px"),this.context.pv.firstElementChild.setAttributeNS(null,"height",d+"px"),!0):!1};
Pj.prototype.Bb=function(a,b,c){a=this.ownerDocument.createElementNS(this.aB,a);if(Fa(b))for(var d in b)a.setAttributeNS("href"===d?"http://www.w3.org/1999/xlink":"",d,b[d]);void 0!==c&&(a.textContent=c);return a};Pj.prototype.getBoundingClientRect=function(){return this.La.getBoundingClientRect()};Pj.prototype.focus=function(){this.La.focus()};Pj.prototype.wy=function(){this.ownerDocument=null};
ma.Object.defineProperties(Pj.prototype,{width:{configurable:!0,get:function(){return this.La.width.baseVal.value},set:function(a){this.La.width=a}},height:{configurable:!0,get:function(){return this.La.height.baseVal.value},set:function(a){this.La.height=a}},style:{configurable:!0,get:function(){return this.La.style}}});Pj.className="SVGSurface";
function jm(a){this.Xk=a;this.svg=a.La;this.stack=[];this.Fc=[];this.fillStyle="#000000";this.font="10px sans-serif";this.globalAlpha=1;this.lineCap="butt";this.lineDashOffset=0;this.lineJoin="miter";this.lineWidth=1;this.miterLimit=10;this.shadowBlur=0;this.shadowColor="rgba(0, 0, 0, 0)";this.shadowOffsetY=this.shadowOffsetX=0;this.strokeStyle="#000000";this.textAlign="start";this.clipInsteadOfFill=!1;this.wf=this.iq=this.hq=0;this.br=null;this.path=[];this.gv=!1;this.Gh=null;this.Hh=0;this.ee=new hm;
km(this,1,0,0,1,0,0);var b=wb++,c=this.Bb("clipPath",{id:"mainClip"+b});c.appendChild(this.Bb("rect",{x:0,y:0,width:a.width,height:a.height}));this.pv=c;this.Xk.La.appendChild(c);this.Fc[0].setAttributeNS(null,"clip-path","url(#mainClip"+b+")");this.cB={}}t=jm.prototype;
t.reset=function(){this.stack=[];this.Fc=[];this.fillStyle="#000000";this.font="10px sans-serif";this.globalAlpha=1;this.lineCap="butt";this.lineDashOffset=0;this.lineJoin="miter";this.lineWidth=1;this.miterLimit=10;this.shadowBlur=0;this.shadowColor="rgba(0, 0, 0, 0)";this.shadowOffsetY=this.shadowOffsetX=0;this.strokeStyle="#000000";this.textAlign="start";this.clipInsteadOfFill=!1;this.wf=this.iq=this.hq=0;this.br=null;this.path=[];this.ee=new hm;km(this,1,0,0,1,0,0);var a=wb++,b=this.Bb("clipPath",
{id:"mainClip"+a});b.appendChild(this.Bb("rect",{x:0,y:0,width:this.Xk.width,height:this.Xk.height}));this.pv=b;this.Xk.La.appendChild(b);this.Fc[0].setAttributeNS(null,"clip-path","url(#mainClip"+a+")")};
t.arc=function(a,b,c,d,e,f,g,h){var k=2*Math.PI,l=k-1E-6,m=c*Math.cos(d),n=c*Math.sin(d),p=a+m,r=b+n,q=f?0:1;d=f?d-e:e-d;(1E-6<Math.abs(g-p)||1E-6<Math.abs(h-r))&&this.path.push(["L",p,+r]);0>d&&(d=d%k+k);d>l?(this.path.push(["A",c,c,0,1,q,a-m,b-n]),this.path.push(["A",c,c,0,1,q,p,r])):1E-6<d&&this.path.push(["A",c,c,0,+(d>=Math.PI),q,a+c*Math.cos(e),b+c*Math.sin(e)])};t.beginPath=function(){this.path=[]};t.bezierCurveTo=function(a,b,c,d,e,f){this.path.push(["C",a,b,c,d,e,f])};t.clearRect=function(){};
t.clip=function(){this.addPath("clipPath",this.path,this.ee);this.addPath("clipPath",this.path,new hm)};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new im("linear");e.x1=a;e.y1=b;e.x2=c;e.y2=d;return e};
t.createPattern=function(a){var b="";a instanceof HTMLCanvasElement&&(b=a.toDataURL());a instanceof HTMLImageElement&&(b=a.getAttribute("src"));var c=this.cB;if(c[b])return"url(#"+c[b]+")";var d="PATTERN"+wb++,e={x:0,y:0,width:a.width,height:a.height,href:b};a=this.Bb("pattern",{width:a.width,height:a.height,id:d,patternUnits:"userSpaceOnUse"});a.appendChild(this.Bb("image",e));this.svg.appendChild(a);c[b]=d;return"url(#"+d+")"};
t.createRadialGradient=function(a,b,c,d,e,f){var g=new im("radial");g.x1=a;g.y1=b;g.r1=c;g.x2=d;g.y2=e;g.r2=f;return g};
t.drawImage=function(a,b,c,d,e,f,g,h,k){var l="";a instanceof HTMLCanvasElement&&(l=a.toDataURL());a instanceof HTMLImageElement&&(l=a.getAttribute("src"));var m=a instanceof HTMLImageElement?a.naturalWidth:a.width,n=a instanceof HTMLImageElement?a.naturalHeight:a.height;void 0===d&&(f=b,g=c,h=d=m,k=e=n);d=d||0;e=e||0;f=f||0;g=g||0;h=h||0;k=k||0;a={x:0,y:0,width:m||d,height:n||e,href:l};K.ca(d,h)&&K.ca(e,k)?-1===l.toLowerCase().indexOf(".svg")&&-1===l.toLowerCase().indexOf("data:image/svg")&&(a.preserveAspectRatio=
"xMidYMid slice"):a.preserveAspectRatio="none";l="";h/=d;k/=e;if(0!==f||0!==g)l+=" translate("+f+", "+g+")";if(1!==h||1!==k)l+=" scale("+h+", "+k+")";if(0!==b||0!==c)l+=" translate("+-b+", "+-c+")";if(0!==b||0!==c||d!==m||e!==n)f="CLIP"+wb++,g=this.Bb("clipPath",{id:f}),g.appendChild(this.Bb("rect",{x:b,y:c,width:d,height:e})),this.svg.appendChild(g),a["clip-path"]="url(#"+f+")";lm(this,"image",a,this.ee,l);this.addElement("image",a)};t.fill=function(){this.addPath("fill",this.path,this.ee)};
t.fe=function(){this.clipInsteadOfFill?this.clip():this.fill()};t.fillRect=function(a,b,c,d){a=[a,b,c,d];a={x:a[0],y:a[1],width:a[2],height:a[3]};lm(this,"fill",a,this.ee);this.addElement("rect",a)};t.fillText=function(a,b,c){a=[a,b,c];b=this.textAlign;"left"===b?b="start":"right"===b?b="end":"center"===b&&(b="middle");b={x:a[1],y:a[2],style:"font: "+this.font,"text-anchor":b};lm(this,"fill",b,this.ee);this.addElement("text",b,a[0])};t.lineTo=function(a,b){this.path.push(["L",a,b])};
t.moveTo=function(a,b){this.path.push(["M",a,b])};t.quadraticCurveTo=function(a,b,c,d){this.path.push(["Q",a,b,c,d])};t.rect=function(a,b,c,d){this.path.push(["M",a,b],["L",a+c,b],["L",a+c,b+d],["L",a,b+d],["z"])};
t.restore=function(){this.ee=this.stack.pop();this.path=this.stack.pop();var a=this.stack.pop();this.fillStyle=a.fillStyle;this.font=a.font;this.globalAlpha=a.globalAlpha;this.lineCap=a.lineCap;this.lineDashOffset=a.lineDashOffset;this.lineJoin=a.lineJoin;this.lineWidth=a.lineWidth;this.miterLimit=a.miterLimit;this.shadowBlur=a.shadowBlur;this.shadowColor=a.shadowColor;this.shadowOffsetX=a.shadowOffsetX;this.shadowOffsetY=a.shadowOffsetY;this.strokeStyle=a.strokeStyle;this.textAlign=a.textAlign};
t.save=function(){this.stack.push({fillStyle:this.fillStyle,font:this.font,globalAlpha:this.globalAlpha,lineCap:this.lineCap,lineDashOffset:this.lineDashOffset,lineJoin:this.lineJoin,lineWidth:this.lineWidth,miterLimit:this.miterLimit,shadowBlur:this.shadowBlur,shadowColor:this.shadowColor,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,strokeStyle:this.strokeStyle,textAlign:this.textAlign});for(var a=[],b=0;b<this.path.length;b++)a.push(this.path[b]);this.stack.push(a);this.stack.push(this.ee.copy())};
t.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||km(this,a,b,c,d,e,f)};t.scale=function(a,b){this.ee.scale(a,b)};t.translate=function(a,b){this.ee.translate(a,b)};t.transform=function(){};t.stroke=function(){this.addPath("stroke",this.path,this.ee)};t.Gj=function(){this.clipInsteadOfFill||this.stroke()};t.Bb=function(a,b,c){return this.Xk.Bb(a,b,c)};
t.addElement=function(a,b,c){a=this.Bb(a,b,c);0<this.Fc.length?this.Fc[this.Fc.length-1].appendChild(a):this.svg.appendChild(a);return this.br=a};
function lm(a,b,c,d,e){1!==a.globalAlpha&&(c.opacity=a.globalAlpha);"fill"===b?(a.fillStyle instanceof im?c.fill=mm(a,a.fillStyle):/^rgba\(/.test(a.fillStyle)?(a=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.fillStyle),c.fill="rgb("+a[1]+","+a[2]+","+a[3]+")",c["fill-opacity"]=a[4]):c.fill=a.fillStyle,c.stroke="none"):"stroke"===b&&(c.fill="none",a.strokeStyle instanceof im?c.stroke=mm(a,a.strokeStyle):/^rgba\(/.test(a.strokeStyle)?(b=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.strokeStyle),
c.stroke="rgb("+b[1]+","+b[2]+","+b[3]+")",c["stroke-opacity"]=b[4]):c.stroke=a.strokeStyle,c["stroke-width"]=a.lineWidth,c["stroke-linecap"]=a.lineCap,c["stroke-linejoin"]=a.lineJoin,c["stroke-miterlimit"]=a.miterLimit);d=d.Sa;d="matrix("+d[0]+", "+d[1]+", "+d[2]+", "+d[3]+", "+d[4]+", "+d[5]+")";void 0!==e&&(d+=e);c.transform=d}
function mm(a,b){var c="GRAD"+wb++;if("linear"===b.type)var d=a.Bb("linearGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,id:c,gradientUnits:"userSpaceOnUse"});else if("radial"===b.type)d=a.Bb("radialGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,r1:b.r1,r2:b.r2,id:c});else throw Error("invalid gradient");var e=b.py;b=e.length;for(var f=[],g=0;g<b;g++){var h=e[g],k=h.color;h={offset:h.offset,"stop-color":k};/^rgba\(/.test(k)&&(k=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(k),
h["stop-color"]="rgb("+k[1]+","+k[2]+","+k[3]+")",h["stop-opacity"]=k[4]);f.push(h)}f.sort(function(a,b){return a.offset>b.offset?1:-1});for(e=0;e<b;e++)d.appendChild(a.Bb("stop",f[e]));a.svg.appendChild(d);return"url(#"+c+")"}
t.addPath=function(a,b,c){for(var d=[],e=0;e<b.length;e++){var f=Ia(b[e]),g=[f.shift()];if("A"===g[0])g.push(f.shift()+","+f.shift(),f.shift(),f.shift()+","+f.shift(),f.shift()+","+f.shift());else for(;f.length;)g.push(f.shift()+","+f.shift());d.push(g.join(" "))}b={d:d.join(" ")};"stroke"===a&&this.gv&&(b["stroke-dasharray"]=this.Gh.toString(),b["stroke-dashoffset"]=this.Hh);lm(this,a,b,c);"clipPath"===a?(a="CLIP"+wb++,c=this.Bb("clipPath",{id:a}),c.appendChild(this.Bb("path",b)),this.svg.appendChild(c),
0<this.Fc.length&&this.Fc[this.Fc.length-1].setAttributeNS(null,"clip-path","url(#"+a+")")):this.addElement("path",b)};function km(a,b,c,d,e,f,g){var h=new hm;h.Sa=[b,c,d,e,f,g];b={};lm(a,"g",b,h);h=a.addElement("g",b);a.Fc.push(h)}
t.vr=function(){if(0!==this.shadowOffsetX||0!==this.shadowOffsetY||0!==this.shadowBlur){var a="SHADOW"+wb++,b=this.addElement("filter",{id:a,x:"-100%",y:"-100%",width:"300%",height:"300%"},null);var c=this.Bb("feGaussianBlur",{"in":"SourceAlpha",result:"blur",JB:this.shadowBlur/2});var d=this.Bb("feFlood",{"in":"blur",result:"flood","flood-color":this.shadowColor});var e=this.Bb("feComposite",{"in":"flood",in2:"blur",operator:"in",result:"comp"});var f=this.Bb("feOffset",{"in":"comp",result:"offsetBlur",
dx:this.shadowOffsetX,dy:this.shadowOffsetY});var g=this.Bb("feMerge",{});g.appendChild(this.Bb("feMergeNode",{"in":"offsetBlur"}));g.appendChild(this.Bb("feMergeNode",{"in":"SourceGraphic"}));b.appendChild(c);b.appendChild(d);b.appendChild(e);b.appendChild(f);b.appendChild(g);0<this.Fc.length&&this.Fc[this.Fc.length-1].setAttributeNS(null,"filter","url(#"+a+")")}};t.Vw=function(a,b,c){this.hq=a;this.iq=b;this.wf=c};function Gl(a){a.shadowOffsetX=0;a.shadowOffsetY=0;a.shadowBlur=0}
function Fl(a){a.shadowOffsetX=a.hq;a.shadowOffsetY=a.iq;a.shadowBlur=a.wf}t.Tt=function(a,b){this.gv=!0;this.Gh=a;this.Hh=b};t.Rt=function(){this.gv=!1};t.zc=function(){};t.ez=function(){};jm.prototype.rotate=function(){};jm.prototype.getImageData=function(){return null};jm.prototype.measureText=function(){return null};jm.className="SVGContext";
Q.prototype.lu=function(a){var b=new Pj(this,qa.document);void 0===a&&(a=new jb);var c=this;return Ok(this,function(a,e){a=Pk(c,a,"SVG",b);a=null!==a?a.svg:null;return"function"===typeof e?(e(a),null):a},a)};Q.prototype.makeSvg=Q.prototype.lu;Q.prototype.vw=function(a){return this.lu(a)};Q.prototype.makeSVG=Q.prototype.vw;
N.prototype.xy=function(a,b){if(!(a instanceof jm))return!1;if(!this.visible)return!0;var c=null,d=a.br;if(this instanceof V&&(this.type===V.TableRow||this.type===V.TableColumn))return Dl(this,a,b),!0;var e=this.Cb;if(0===e.width||0===e.height||isNaN(e.x)||isNaN(e.y))return!0;var f=this.transform,g=this.panel;0!==(this.I&4096)===!0&&El(this);var h=0!==(this.I&256),k=!1;this instanceof ih&&(a.font=this.font);if(h){k=g.le()?g.naturalBounds:g.actualBounds;if(null!==this.vd){var l=this.vd;var m=l.x;var n=
l.y;var p=l.width;l=l.height}else m=Math.max(e.x,k.x),n=Math.max(e.y,k.y),p=Math.min(e.right,k.right)-m,l=Math.min(e.bottom,k.bottom)-n;if(m>e.width+e.x||e.x>k.width+k.x||n>e.height+e.y||e.y>k.height+k.y)return!0;k=!0;km(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(m,n,p,l);a.clip()}if(this.Qf()&&!this.isVisible())return!0;a.ee.Sa=[1,0,0,1,0,0];(this instanceof ih&&1<this.lineCount||this instanceof Yf&&1<this.geometry.figures.length)&&km(a,1,0,0,1,0,0);m=!1;this.Qf()&&this.isShadowed&&b.Te("drawShadows")&&
(n=this.shadowOffset,a.Vw(n.x*b.scale*b.Yb,n.y*b.scale*b.Yb,this.shadowBlur),Fl(a),a.shadowColor=this.shadowColor);n=!1;this.part&&b.Te("drawShadows")&&(n=this.part.isShadowed);!0===this.shadowVisible?(Fl(a),!1===m&&n&&(km(a,1,0,0,1,0,0),a.vr(),m=!0)):!1===this.shadowVisible&&Gl(a);p=this.naturalBounds;null!==this.areaBackground&&(zi(this,a,this.areaBackground,!0,!0,p,e),!1===m&&n&&(km(a,1,0,0,1,0,0),a.vr(),m=!0),this.areaBackground instanceof Hl&&this.areaBackground.type===Il?(a.beginPath(),a.rect(e.x,
e.y,e.width,e.height),a.fe(this.areaBackground)):a.fillRect(e.x,e.y,e.width,e.height));this instanceof V?km(a,f.m11,f.m12,f.m21,f.m22,f.dx,f.dy):a.ee.Sa=[f.m11,f.m12,f.m21,f.m22,f.dx,f.dy];if(null!==this.background){!1===m&&n&&(km(a,1,0,0,1,0,0),a.vr(),m=!0);var r=this.naturalBounds;l=f=0;var q=r.width;r=r.height;var u=0;this instanceof Yf&&(r=this.geometry.bounds,f=r.x,l=r.y,q=r.width,r=r.height,u=this.strokeWidth);zi(this,a,this.background,!0,!1,p,e);this.background instanceof Hl&&this.background.type===
Il?(a.beginPath(),a.rect(f-u/2,l-u/2,q+u,r+u),a.fe(this.background)):a.fillRect(f-u/2,l-u/2,q+u,r+u)}n&&(null!==this.background||null!==this.areaBackground||null!==g&&0!==(g.I&512)||null!==g&&(g.type===V.Auto||g.type===V.Spot)&&g.ub()!==this)?(Jl(this,!0),null===this.shadowVisible&&Gl(a)):Jl(this,!1);this.pj(a,b);n&&0!==(this.I&512)===!0&&Fl(a);this.Qf()&&n&&Gl(a);h&&(a.restore(),k&&a.Fc.pop());this instanceof V&&(c=a.Fc.pop());!0===m&&a.Fc.pop();if(this instanceof ih&&1<this.lineCount||this instanceof
Yf&&1<this.geometry.figures.length)c=a.Fc.pop();null!==a.Xk.Oq&&(null===c&&(d===a.br?(km(a,1,0,0,1,0,0),c=a.Fc.pop()):c=a.br),a.Xk.Oq(this,c));this.svg=c;return!0};function Qk(a,b){this.ownerDocument=b=void 0===b?qa.document:b;this.Oq=null;b=b.createElement("canvas");b.tabIndex=0;this.La=b;this.La.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";this.context=new Ll(b);b.B=a}
Qk.prototype.resize=function(a,b,c,d){return this.width!==a||this.height!==b?(this.width=a,this.height=b,this.style.width=c+"px",this.style.height=d+"px",!0):!1};Qk.prototype.toDataURL=function(a,b){return this.La.toDataURL(a,b)};Qk.prototype.getBoundingClientRect=function(){return this.La.getBoundingClientRect()};Qk.prototype.focus=function(){this.La.focus()};Qk.prototype.wy=function(){this.ownerDocument=this.La.B=null};
ma.Object.defineProperties(Qk.prototype,{width:{configurable:!0,get:function(){return this.La.width},set:function(a){this.La.width=a}},height:{configurable:!0,get:function(){return this.La.height},set:function(a){this.La.height=a}},style:{configurable:!0,get:function(){return this.La.style}}});Qk.className="CanvasSurface";
function Ll(a){a.getContext&&a.getContext("2d")||v("Browser does not support HTML Canvas Element");this.aa=a.getContext("2d");this.Ju=this.Lu=this.Ku="";this.Kn=!1;this.wf=this.iq=this.hq=0}t=Ll.prototype;t.ez=function(a){this.aa.imageSmoothingEnabled=a};t.arc=function(a,b,c,d,e,f){this.aa.arc(a,b,c,d,e,f)};t.beginPath=function(){this.aa.beginPath()};t.bezierCurveTo=function(a,b,c,d,e,f){this.aa.bezierCurveTo(a,b,c,d,e,f)};t.clearRect=function(a,b,c,d){this.aa.clearRect(a,b,c,d)};t.clip=function(){this.aa.clip()};
t.closePath=function(){this.aa.closePath()};t.createLinearGradient=function(a,b,c,d){return this.aa.createLinearGradient(a,b,c,d)};t.createPattern=function(a,b){return this.aa.createPattern(a,b)};t.createRadialGradient=function(a,b,c,d,e,f){return this.aa.createRadialGradient(a,b,c,d,e,f)};t.drawImage=function(a,b,c,d,e,f,g,h,k){void 0===d?this.aa.drawImage(a,b,c):this.aa.drawImage(a,b,c,d,e,f,g,h,k)};t.fill=function(){this.aa.fill()};t.fillRect=function(a,b,c,d){this.aa.fillRect(a,b,c,d)};
t.fillText=function(a,b,c){this.aa.fillText(a,b,c)};t.getImageData=function(a,b,c,d){return this.aa.getImageData(a,b,c,d)};t.lineTo=function(a,b){this.aa.lineTo(a,b)};t.measureText=function(a){return this.aa.measureText(a)};t.moveTo=function(a,b){this.aa.moveTo(a,b)};t.quadraticCurveTo=function(a,b,c,d){this.aa.quadraticCurveTo(a,b,c,d)};t.rect=function(a,b,c,d){this.aa.rect(a,b,c,d)};t.restore=function(){this.aa.restore()};Ll.prototype.rotate=function(a){this.aa.rotate(a)};t=Ll.prototype;
t.save=function(){this.aa.save()};t.setTransform=function(a,b,c,d,e,f){this.aa.setTransform(a,b,c,d,e,f)};t.scale=function(a,b){this.aa.scale(a,b)};t.stroke=function(){this.aa.stroke()};t.transform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||this.aa.transform(a,b,c,d,e,f)};t.translate=function(a,b){this.aa.translate(a,b)};
t.fe=function(a){if(a instanceof Hl&&a.type===Il){var b=a.ll;a=a.Mu;a>b?(this.scale(b/a,1),this.translate((a-b)/2,0)):b>a&&(this.scale(1,a/b),this.translate(0,(b-a)/2));this.Kn?this.clip():this.fill();a>b?(this.translate(-(a-b)/2,0),this.scale(1/(b/a),1)):b>a&&(this.translate(0,-(b-a)/2),this.scale(1,1/(a/b)))}else this.Kn?this.clip():this.fill()};t.Gj=function(){this.Kn||this.stroke()};t.Vw=function(a,b,c){this.hq=a;this.iq=b;this.wf=c};
t.Tt=function(a,b){var c=this.aa;void 0!==c.setLineDash&&(c.setLineDash(a),c.lineDashOffset=b)};t.Rt=function(){var a=this.aa;void 0!==a.setLineDash&&(a.setLineDash(nm),a.lineDashOffset=0)};t.zc=function(a){a&&(this.Ku="");this.Ju=this.Lu=""};
ma.Object.defineProperties(Ll.prototype,{fillStyle:{configurable:!0,get:function(){return this.aa.fillStyle},set:function(a){this.Ju!==a&&(this.Ju=this.aa.fillStyle=a)}},font:{configurable:!0,get:function(){return this.aa.font},set:function(a){this.Ku!==a&&(this.Ku=this.aa.font=a)}},globalAlpha:{configurable:!0,get:function(){return this.aa.globalAlpha},set:function(a){this.aa.globalAlpha=a}},lineCap:{configurable:!0,get:function(){return this.aa.lineCap},
set:function(a){this.aa.lineCap=a}},lineDashOffset:{configurable:!0,get:function(){return this.aa.lineDashOffset},set:function(a){this.aa.lineDashOffset=a}},lineJoin:{configurable:!0,get:function(){return this.aa.lineJoin},set:function(a){this.aa.lineJoin=a}},lineWidth:{configurable:!0,get:function(){return this.aa.lineWidth},set:function(a){this.aa.lineWidth=a}},miterLimit:{configurable:!0,get:function(){return this.aa.miterLimit},set:function(a){this.aa.miterLimit=
a}},shadowBlur:{configurable:!0,get:function(){return this.aa.shadowBlur},set:function(a){this.aa.shadowBlur=a}},shadowColor:{configurable:!0,get:function(){return this.aa.shadowColor},set:function(a){this.aa.shadowColor=a}},shadowOffsetX:{configurable:!0,get:function(){return this.aa.shadowOffsetX},set:function(a){this.aa.shadowOffsetX=a}},shadowOffsetY:{configurable:!0,get:function(){return this.aa.shadowOffsetY},set:function(a){this.aa.shadowOffsetY=
a}},strokeStyle:{configurable:!0,get:function(){return this.aa.strokeStyle},set:function(a){this.Lu!==a&&(this.Lu=this.aa.strokeStyle=a)}},textAlign:{configurable:!0,get:function(){return this.aa.textAlign},set:function(a){this.aa.textAlign=a}},imageSmoothingEnabled:{configurable:!0,get:function(){return this.aa.imageSmoothingEnabled},set:function(a){this.aa.imageSmoothingEnabled=a}},clipInsteadOfFill:{configurable:!0,get:function(){return this.Kn},
set:function(a){this.Kn=a}}});var nm=Object.freeze([]);Ll.className="CanvasSurfaceContext";function om(){this.W=this.w=this.L=this.l=0}om.className="ColorNumbers";
function Hl(a){F&&1<arguments.length&&v("Brush constructor can take at most one optional argument, the Brush type.");pm||(qm(),pm=!0);fb(this);this.s=!1;void 0===a?(this.sa=Kl,this.kl="black"):"string"===typeof a?(this.sa=Kl,F&&!rm(a)&&v('Color "'+a+'" is not a valid color string for Brush constructor'),this.kl=a):(F&&hb(a,Hl,Hl,"constructor:type"),this.sa=a,this.kl="black");var b=this.sa;b===Nl?(this.Ed=Ic,this.xl=Pc):this.xl=b===Il?this.Ed=Mc:this.Ed=Gc;this.wt=0;this.ms=NaN;this.qe=this.Zs=this.pe=
null;this.Mu=this.ll=0}Hl.prototype.copy=function(){var a=new Hl;a.sa=this.sa;a.kl=this.kl;a.Ed=this.Ed.J();a.xl=this.xl.J();a.wt=this.wt;a.ms=this.ms;null!==this.pe&&(a.pe=this.pe.copy());a.Zs=this.Zs;return a};t=Hl.prototype;t.freeze=function(){this.s=!0;null!==this.pe&&this.pe.freeze();return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;null!==this.pe&&this.pe.ka();return this};t.nb=function(a){a.classType===Hl?this.type=a:Ba(this,a)};
t.toString=function(){var a="Brush(";if(this.type===Kl)a+=this.color;else if(a=this.type===Nl?a+"Linear ":this.type===Il?a+"Radial ":this.type===Ml?a+"Pattern ":a+"(unknown) ",a+=this.start+" "+this.end,null!==this.colorStops)for(var b=this.colorStops.iterator;b.next();)a+=" "+b.key+":"+b.value;return a+")"};
t.addColorStop=function(a,b){this.s&&va(this);("number"!==typeof a||!isFinite(a)||1<a||0>a)&&ya(a,"0 <= loc <= 1",Hl,"addColorStop:loc");A(b,"string",Hl,"addColorStop:color");F&&!rm(b)&&v('Color "'+b+'" is not a valid color string for Brush.addColorStop');null===this.pe&&(this.pe=new Db);this.pe.add(a,b);this.sa===Kl&&(this.type=Nl);this.qe=null;return this};
function rm(a){if("black"===a)return!0;if(""===a)return!1;F&&A(a,"string",Hl,"isValidColor");pm||(qm(),pm=!0);var b=sm;if(null===b)return!0;b.fillStyle="#000000";var c=b.fillStyle;b.fillStyle=a;if(b.fillStyle!==c)return!0;b.fillStyle="#FFFFFF";c=b.fillStyle;b.fillStyle=a;return b.fillStyle!==c}
t.VA=function(a,b){this.s&&va(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?tm:b;if(this.type===Kl)hi(this.color),this.color=um(a,b);else if((this.type===Nl||this.type===Il)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)hi(c.value),this.addColorStop(c.key,um(a,b));return this};function vm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?tm:c;hi(a);return um(b,c)}
t.Uz=function(a,b){this.s&&va(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?tm:b;if(this.type===Kl)hi(this.color),this.color=um(-a,b);else if((this.type===Nl||this.type===Il)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)hi(c.value),this.addColorStop(c.key,um(-a,b));return this};function wm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?tm:c;hi(a);return um(-b,c)}
function xm(a,b,c){hi(a);a=ym.l;var d=ym.L,e=ym.w,f=ym.W;hi(b);void 0===c&&(c=.5);return"rgba("+Math.round((ym.l-a)*c+a)+", "+Math.round((ym.L-d)*c+d)+", "+Math.round((ym.w-e)*c+e)+", "+Math.round((ym.W-f)*c+f)+")"}
t.Sy=function(){if(this.type===Kl)return zm(this.color);if((this.type===Nl||this.type===Il)&&null!==this.colorStops){var a=this.colorStops;if(this.type===Il)return zm(a.first().value);if(null!==a.get(.5))return zm(a.get(.5));if(2===a.count)return a=a.ta(),zm(xm(a[0].value,a[1].value));for(var b=a.iterator,c=-1,d=-1,e=1,f=1;b.next();){var g=b.key,h=Math.abs(.5-b.key);e>f&&h<e?(c=g,e=h):f>=e&&h<f&&(d=g,f=h)}c>d&&(f=c,c=d,d=f,f=e);e=d-c;return zm(xm(a.get(c),a.get(d),1-f/e))}return!1};
function zm(a){if(!a)return!1;if(a instanceof Hl)return a.Sy();hi(a);return 128>(299*ym.l+587*ym.L+114*ym.w)/1E3}
function um(a,b){switch(b){case tm:b=100*Am(ym.l);var c=100*Am(ym.L),d=100*Am(ym.w);Bm.l=.4124564*b+.3575761*c+.1804375*d;Bm.L=.2126729*b+.7151522*c+.072175*d;Bm.w=.0193339*b+.119192*c+.9503041*d;Bm.W=ym.W;b=Cm(Bm.l/Dm[0]);c=Cm(Bm.L/Dm[1]);d=Cm(Bm.w/Dm[2]);Em.l=116*c-16;Em.L=500*(b-c);Em.w=200*(c-d);Em.W=Bm.W;Em.l=Math.min(100,Math.max(0,Em.l+100*a));a=(Em.l+16)/116;b=a-Em.w/200;Bm.l=Dm[0]*Fm(Em.L/500+a);Bm.L=Dm[1]*(Em.l>Gm*Hm?Math.pow(a,3):Em.l/Gm);Bm.w=Dm[2]*Fm(b);Bm.W=Em.W;a=-.969266*Bm.l+1.8760108*
Bm.L+.041556*Bm.w;b=.0556434*Bm.l+-.2040259*Bm.L+1.0572252*Bm.w;ym.l=255*Im((3.2404542*Bm.l+-1.5371385*Bm.L+-.4985314*Bm.w)/100);ym.L=255*Im(a/100);ym.w=255*Im(b/100);ym.W=Bm.W;ym.l=Math.round(ym.l);255<ym.l?ym.l=255:0>ym.l&&(ym.l=0);ym.L=Math.round(ym.L);255<ym.L?ym.L=255:0>ym.L&&(ym.L=0);ym.w=Math.round(ym.w);255<ym.w?ym.w=255:0>ym.w&&(ym.w=0);return"rgba("+ym.l+", "+ym.L+", "+ym.w+", "+ym.W+")";case Jm:return ii(),ji.w=Math.min(100,Math.max(0,ji.w+100*a)),"hsla("+ji.l+", "+ji.L+"%, "+ji.w+"%, "+
ji.W+")";default:return v("Unknown color space: "+b),"rgba(0, 0, 0, 1)"}}function hi(a){pm||(qm(),pm=!0);var b=sm;if(null!==b){b.clearRect(0,0,1,1);b.fillStyle="#000000";var c=b.fillStyle;b.fillStyle=a;b.fillStyle!==c?(b.fillRect(0,0,1,1),a=b.getImageData(0,0,1,1).data,ym.l=a[0],ym.L=a[1],ym.w=a[2],ym.W=a[3]/255):(b.fillStyle="#FFFFFF",c=b.fillStyle,b.fillStyle=a,b.fillStyle===c&&F&&v('Color "'+a+'" is not a valid color string for RGBA color conversion'),ym.l=0,ym.L=0,ym.w=0,ym.W=1)}}
function ii(){var a=ym.l/255,b=ym.L/255,c=ym.w/255,d=Math.max(a,b,c),e=Math.min(a,b,c),f=d-e;e=(d+e)/2;if(0===f)var g=a=0;else{switch(d){case a:g=(b-c)/f%6;break;case b:g=(c-a)/f+2;break;case c:g=(a-b)/f+4}g*=60;0>g&&(g+=360);a=f/(1-Math.abs(2*e-1))}ji.l=Math.round(g);ji.L=Math.round(100*a);ji.w=Math.round(100*e);ji.W=ym.W}function Am(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}function Im(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055}
function Cm(a){return a>Hm?Math.pow(a,1/3):(Gm*a+16)/116}function Fm(a){var b=a*a*a;return b>Hm?b:(116*a-16)/Gm}function em(a,b){"string"===typeof a?F&&!rm(a)&&v('Color "'+a+'" is not a valid color string for '+b):a instanceof Hl||v("Value for "+b+" must be a color string or a Brush, not "+a)}function qm(){sm=gh?(new Qk(null)).context:null}
ma.Object.defineProperties(Hl.prototype,{type:{configurable:!0,get:function(){return this.sa},set:function(a){this.s&&va(this,a);hb(a,Hl,Hl,"type");this.sa=a;this.start.Sb()&&(a===Nl?this.start=Ic:a===Il&&(this.start=Mc));this.end.Sb()&&(a===Nl?this.end=Pc:a===Il&&(this.end=Mc));this.qe=null}},color:{configurable:!0,get:function(){return this.kl},set:function(a){this.s&&va(this,a);F&&!rm(a)&&v('Color "'+a+'" is not a valid color string for Brush.color');this.kl=a;this.qe=
null}},start:{configurable:!0,get:function(){return this.Ed},set:function(a){this.s&&va(this,a);x(a,M,Hl,"start");this.Ed=a.J();this.qe=null}},end:{configurable:!0,get:function(){return this.xl},set:function(a){this.s&&va(this,a);x(a,M,Hl,"end");this.xl=a.J();this.qe=null}},startRadius:{configurable:!0,get:function(){return this.wt},set:function(a){this.s&&va(this,a);C(a,Hl,"startRadius");0>a&&ya(a,">= zero",Hl,"startRadius");this.wt=a;this.qe=null}},endRadius:{configurable:!0,
enumerable:!0,get:function(){return this.ms},set:function(a){this.s&&va(this,a);C(a,Hl,"endRadius");0>a&&ya(a,">= zero",Hl,"endRadius");this.ms=a;this.qe=null}},colorStops:{configurable:!0,get:function(){return this.pe},set:function(a){this.s&&va(this,a);F&&x(a,Db,Hl,"colorStops");this.pe=a;this.qe=null}},pattern:{configurable:!0,get:function(){return this.Zs},set:function(a){this.s&&va(this,a);this.Zs=a;this.qe=null}}});Hl.prototype.isDark=Hl.prototype.Sy;
Hl.prototype.darkenBy=Hl.prototype.Uz;Hl.prototype.lightenBy=Hl.prototype.VA;Hl.prototype.addColorStop=Hl.prototype.addColorStop;var Hm=216/24389,Gm=24389/27,Dm=[95.047,100,108.883],sm=null,ym=new om,ji=new om,Bm=new om,Em=new om,pm=!1;Hl.className="Brush";var Kl;Hl.Solid=Kl=new E(Hl,"Solid",0);var Nl;Hl.Linear=Nl=new E(Hl,"Linear",1);var Il;Hl.Radial=Il=new E(Hl,"Radial",2);var Ml;Hl.Pattern=Ml=new E(Hl,"Pattern",4);var tm;Hl.Lab=tm=new E(Hl,"Lab",5);var Jm;Hl.HSL=Jm=new E(Hl,"HSL",6);
Hl.randomColor=function(a,b){void 0===a&&(a=128);F&&(C(a,Hl,"randomColor:min"),(0>a||255<a)&&ya(a,"0 <= min <= 255",Hl,"randomColor:min"));void 0===b&&(b=Math.max(a,255));F&&(C(b,Hl,"randomColor:max"),(b<a||255<b)&&ya(b,"min <= max <= 255",Hl,"randomColor:max"));var c=Math.abs(b-a);b=Math.floor(a+Math.random()*c).toString(16);var d=Math.floor(a+Math.random()*c).toString(16);a=Math.floor(a+Math.random()*c).toString(16);2>b.length&&(b="0"+b);2>d.length&&(d="0"+d);2>a.length&&(a="0"+a);return"#"+b+d+
a};Hl.isValidColor=rm;Hl.lighten=function(a){return vm(a)};Hl.lightenBy=vm;Hl.darken=function(a){return wm(a)};Hl.darkenBy=wm;Hl.mix=xm;Hl.isDark=zm;function bm(){this.name="Base"}bm.prototype.measure=function(){};bm.prototype.YA=function(a,b,c,d,e){a.measure(b,c,d,e)};bm.prototype.arrange=function(){};bm.prototype.Hz=function(a,b,c,d,e,f){a.arrange(b,c,d,e,f)};bm.prototype.hc=function(){};ma.Object.defineProperties(bm.prototype,{classType:{configurable:!0,get:function(){return V}}});
bm.prototype.arrangeElement=bm.prototype.Hz;bm.prototype.measureElement=bm.prototype.YA;bm.className="PanelLayout";function Km(){this.name="Base"}la(Km,bm);
Km.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;a=Lm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===a){var m=l.margin,n=m.right+m.left;m=m.top+m.bottom;l.measure(b,c,f,g);var p=l.measuredBounds;n=Math.max(p.width+n,0);m=Math.max(p.height+m,0);p=l.position.x;var r=l.position.y;isFinite(p)||(p=0);isFinite(r)||(r=0);l instanceof Yf&&l.isGeometryPositioned&&(l=l.strokeWidth/2,p-=l,r-=l);qc(e,p,r,n,m)}}};
Km.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding;a=c.x-e.left;c=c.y-e.top;for(e=0;e<d;e++){var f=b[e],g=f.measuredBounds,h=f.margin,k=f.position.x,l=f.position.y;k=isNaN(k)?-a:k-a;l=isNaN(l)?-c:l-c;if(f instanceof Yf&&f.isGeometryPositioned){var m=f.strokeWidth/2;k-=m;l-=m}f.visible&&f.arrange(k+h.left,l+h.top,g.width,g.height)}};function Mm(){this.name="Base"}la(Mm,bm);
Mm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;b=La();f=Lm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===f){var m=yl(l,!1);if(m!==Mg&&m!==jl)b.push(l);else{l.measure(Infinity,c,0,g);m=l.margin;l=l.measuredBounds;var n=Math.max(l.height+m.top+m.bottom,0);e.width+=Math.max(l.width+m.right+m.left,0);e.height=Math.max(e.height,n)}}}d=b.length;a.desiredSize.height?c=Math.min(a.desiredSize.height,a.maxSize.height):0!==e.height&&(c=Math.min(e.height,a.maxSize.height));for(a=0;a<d;a++)if(k=
b[a],k.visible||k===f)m=k.margin,h=m.right+m.left,m=m.top+m.bottom,k.measure(Infinity,c,0,g),k=k.measuredBounds,m=Math.max(k.height+m,0),e.width+=Math.max(k.width+h,0),e.height=Math.max(e.height,m);Oa(b)};
Mm.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.top,g=a.isOpposite,h=g?c.width:e.left,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.top+p.bottom,q=f+e.bottom,u=n.height,w=yl(m,!1);if(isNaN(m.desiredSize.height)&&w===Hd||w===kl)u=Math.max(c.height-r-q,0);r=u+r+q;q=m.alignment;q.Ib()&&(q=a.defaultAlignment);q.cb()||(q=Mc);g&&(h-=n.width+p.left+p.right);m.arrange(h+q.offsetX+p.left,l+q.offsetY+p.top+(c.height*q.y-r*q.y),n.width,u);g||(h+=n.width+
p.left+p.right)}}};function Nm(){this.name="Base"}la(Nm,bm);
Nm.prototype.measure=function(a,b,c,d,e,f){var g=d.length;c=La();for(var h=Lm(a),k=0;k<g;k++){var l=d[k];if(l.visible||l===h){var m=yl(l,!1);if(m!==Mg&&m!==kl)c.push(l);else{var n=l.margin;m=n.right+n.left;n=n.top+n.bottom;l.measure(b,Infinity,f,0);l=l.measuredBounds;gc(e,Math.max(e.width,Math.max(l.width+m,0)),e.height+Math.max(l.height+n,0))}}}d=c.length;if(0!==d){a.desiredSize.width?b=Math.min(a.desiredSize.width,a.maxSize.width):0!==e.width&&(b=Math.min(e.width,a.maxSize.width));for(a=0;a<d;a++)if(k=
c[a],k.visible||k===h)l=k.margin,g=l.right+l.left,l=l.top+l.bottom,k.measure(b,Infinity,f,0),k=k.measuredBounds,l=Math.max(k.height+l,0),e.width=Math.max(e.width,Math.max(k.width+g,0)),e.height+=l;Oa(c)}};
Nm.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.left,g=a.isOpposite,h=g?c.height:e.top,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.left+p.right,q=f+e.right,u=n.width,w=yl(m,!1);if(isNaN(m.desiredSize.width)&&w===Hd||w===jl)u=Math.max(c.width-r-q,0);r=u+r+q;q=m.alignment;q.Ib()&&(q=a.defaultAlignment);q.cb()||(q=Mc);g&&(h-=n.height+p.bottom+p.top);m.arrange(l+q.offsetX+p.left+(c.width*q.x-r*q.x),h+q.offsetY+p.top,u,n.height);g||(h+=n.height+
p.bottom+p.top)}}};function Om(){this.name="Base"}la(Om,bm);
Om.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.ub(),l=k.margin,m=l.right+l.left,n=l.top+l.bottom;k.measure(b,c,f,g);var p=k.measuredBounds;f=p.width;g=p.height;var r=Math.max(f+m,0);var q=Math.max(g+n,0);for(var u=a.isClipping,w=L.allocAt(-l.left,-l.top,r,q),y=!0,z=Lm(a),B=0;B<h;B++){var D=d[B];if(D!==k&&(D.visible||D===z)){l=D.margin;r=l.right+l.left;q=l.top+l.bottom;p=yl(D,!1);switch(p){case Hd:b=f;c=g;break;case jl:b=f;break;case kl:c=g}D.measure(b,c,0,0);p=D.measuredBounds;r=
Math.max(p.width+r,0);q=Math.max(p.height+q,0);var G=D.alignment;G.Ib()&&(G=a.defaultAlignment);G.cb()||(G=Mc);var O=D.alignmentFocus;O.Ib()&&(O=Mc);var T=null;D instanceof V&&""!==D.Xg&&(D.arrange(0,0,p.width,p.height),T=D.gb(D.Xg),T===D&&(T=null));if(null!==T){l=T.naturalBounds;p=T.margin;for(l=J.allocAt(O.x*l.width-O.offsetX-p.left,O.y*l.height-O.offsetY-p.top);T!==D;)T.transform.ya(l),T=T.panel;D=G.x*f+G.offsetX-l.x;p=G.y*g+G.offsetY-l.y;J.free(l)}else D=G.x*f+G.offsetX-(O.x*p.width+O.offsetX)-
l.left,p=G.y*g+G.offsetY-(O.y*p.height+O.offsetY)-l.top;y?(y=!1,e.h(D,p,r,q)):qc(e,D,p,r,q)}}y?e.assign(w):u?e.pw(w.x,w.y,w.width,w.height):qc(e,w.x,w.y,w.width,w.height);L.free(w);p=k.stretch;p===il&&(p=yl(k,!1));switch(p){case Mg:return;case Hd:if(!isFinite(b)&&!isFinite(c))return;break;case jl:if(!isFinite(b))return;break;case kl:if(!isFinite(c))return}p=k.measuredBounds;f=p.width;g=p.height;r=Math.max(f+m,0);q=Math.max(g+n,0);l=k.margin;w=L.allocAt(-l.left,-l.top,r,q);for(b=0;b<h;b++)c=d[b],c===
k||!c.visible&&c!==z||(l=c.margin,r=l.right+l.left,q=l.top+l.bottom,p=c.measuredBounds,r=Math.max(p.width+r,0),q=Math.max(p.height+q,0),m=c.alignment,m.Ib()&&(m=a.defaultAlignment),m.cb()||(m=Mc),c=c.alignmentFocus,c.Ib()&&(c=Mc),y?(y=!1,e.h(m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q)):qc(e,m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q));y?e.assign(w):u?e.pw(w.x,w.y,w.width,w.height):qc(e,w.x,
w.y,w.width,w.height);L.free(w)};
Om.prototype.arrange=function(a,b,c){var d=b.length,e=a.ub(),f=e.measuredBounds,g=f.width;f=f.height;var h=a.padding,k=h.left;h=h.top;var l=k-c.x,m=h-c.y;e.arrange(l,m,g,f);for(var n=0;n<d;n++){var p=b[n];if(p!==e){var r=p.measuredBounds,q=r.width;r=r.height;m=p.alignment;m.Ib()&&(m=a.defaultAlignment);m.cb()||(m=Mc);var u=p.alignmentFocus;u.Ib()&&(u=Mc);l=null;p instanceof V&&""!==p.Xg&&(l=p.gb(p.Xg),l===p&&(l=null));if(null!==l){var w=l.naturalBounds;for(u=J.allocAt(u.x*w.width-u.offsetX,u.y*w.height-
u.offsetY);l!==p;)l.transform.ya(u),l=l.panel;l=m.x*g+m.offsetX-u.x;m=m.y*f+m.offsetY-u.y;J.free(u)}else l=m.x*g+m.offsetX-(u.x*q+u.offsetX),m=m.y*f+m.offsetY-(u.y*r+u.offsetY);l-=c.x;m-=c.y;p.visible&&p.arrange(k+l,h+m,q,r)}}};function Pm(){this.name="Base"}la(Pm,bm);
Pm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.ub(),l=k.margin,m=b,n=c,p=l.right+l.left,r=l.top+l.bottom;k.measure(b,c,f,g);l=k.measuredBounds;var q=0,u=null;k instanceof Yf&&(u=k,q=u.strokeWidth*u.scale);var w=Math.max(l.width+p,0);l=Math.max(l.height+r,0);var y=Qm(k),z=y.x*w+y.offsetX;y=y.y*l+y.offsetY;var B=Rm(k),D=B.x*w+B.offsetX;B=B.y*l+B.offsetY;isFinite(b)&&(m=Math.max(Math.abs(z-D)-q,0));isFinite(c)&&(n=Math.max(Math.abs(y-B)-q,0));q=Hb.alloc();q.h(0,0);a=Lm(a);for(B=0;B<
h;B++)y=d[B],y===k||!y.visible&&y!==a||(l=y.margin,w=l.right+l.left,z=l.top+l.bottom,y.measure(m,n,0,0),l=y.measuredBounds,w=Math.max(l.width+w,0),l=Math.max(l.height+z,0),q.h(Math.max(w,q.width),Math.max(l,q.height)));if(1===h)e.width=w,e.height=l,Hb.free(q);else{y=Qm(k);B=Rm(k);h=d=0;B.x!==y.x&&B.y!==y.y&&(d=q.width/Math.abs(B.x-y.x),h=q.height/Math.abs(B.y-y.y));Hb.free(q);q=0;null!==u&&(q=u.strokeWidth*u.scale,Ng(u)===Og&&(d=h=Math.max(d,h)));d+=Math.abs(y.offsetX)+Math.abs(B.offsetX)+q;h+=Math.abs(y.offsetY)+
Math.abs(B.offsetY)+q;u=k.stretch;u===il&&(u=yl(k,!1));switch(u){case Mg:g=f=0;break;case Hd:isFinite(b)&&(d=b);isFinite(c)&&(h=c);break;case jl:isFinite(b)&&(d=b);g=0;break;case kl:f=0,isFinite(c)&&(h=c)}k.Nm();k.measure(d,h,f,g);e.width=k.measuredBounds.width+p;e.height=k.measuredBounds.height+r}};
Pm.prototype.arrange=function(a,b){var c=b.length,d=a.ub(),e=d.measuredBounds,f=L.alloc();f.h(0,0,1,1);var g=d.margin,h=g.left;g=g.top;var k=a.padding,l=k.left;k=k.top;d.arrange(l+h,k+g,e.width,e.height);var m=Qm(d),n=Rm(d),p=m.y*e.height+m.offsetY,r=n.x*e.width+n.offsetX;n=n.y*e.height+n.offsetY;f.x=m.x*e.width+m.offsetX;f.y=p;qc(f,r,n,0,0);f.x+=h+l;f.y+=g+k;for(e=0;e<c;e++)h=b[e],h!==d&&(l=h.measuredBounds,g=h.margin,k=Math.max(l.width+g.right+g.left,0),m=Math.max(l.height+g.top+g.bottom,0),p=h.alignment,
p.Ib()&&(p=a.defaultAlignment),p.cb()||(p=Mc),k=f.width*p.x+p.offsetX-k*p.x+g.left+f.x,g=f.height*p.y+p.offsetY-m*p.y+g.top+f.y,h.visible&&(rc(f.x,f.y,f.width,f.height,k,g,l.width,l.height)?h.arrange(k,g,l.width,l.height):h.arrange(k,g,l.width,l.height,new L(f.x,f.y,f.width,f.height))));L.free(f)};function Sm(){this.name="Base";this.name="Table"}la(Sm,bm);
Sm.prototype.measure=function(a,b,c,d,e,f,g){for(var h=d.length,k=La(),l=La(),m=0;m<h;m++){var n=d[m],p=n instanceof V?n:null;if(null===p||p.type!==V.TableRow&&p.type!==V.TableColumn||!n.visible)k.push(n);else{F&&(p.desiredSize.o()&&v(p.toString()+" TableRow/TableColumn Panels cannot set a desiredSize: "+p.desiredSize.toString()),p.minSize.A(Wb)||v(p.toString()+" TableRow/TableColumn Panels cannot set a minSize: "+p.minSize.toString()),p.maxSize.A(bc)||v(p.toString()+" TableRow/TableColumn Panels cannot set a maxSize: "+
p.maxSize.toString()));l.push(p);for(var r=p.$.j,q=r.length,u=0;u<q;u++){var w=r[u];p.type===V.TableRow?w.row=n.row:p.type===V.TableColumn&&(w.column=n.column);k.push(w)}}}h=k.length;0===h&&(a.getRowDefinition(0),a.getColumnDefinition(0));for(var y=[],z=0;z<h;z++){var B=k[z];Aj(B,!0);zl(B,!0);y[B.row]||(y[B.row]=[]);y[B.row][B.column]||(y[B.row][B.column]=[]);y[B.row][B.column].push(B)}Oa(k);var D=La(),G=La(),O=La(),T={count:0},P={count:0},ba=b,Y=c,oa=a.zb;h=oa.length;for(var Ea=0;Ea<h;Ea++){var X=
oa[Ea];void 0!==X&&(X.actual=0)}oa=a.vb;h=oa.length;for(var Ma=0;Ma<h;Ma++)X=oa[Ma],void 0!==X&&(X.actual=0);for(var Wa=y.length,yb=0,Va=0;Va<Wa;Va++)y[Va]&&(yb=Math.max(yb,y[Va].length));var Pb=Math.min(a.topIndex,Wa-1),Pd=Math.min(a.leftIndex,yb-1),zb=0;Wa=y.length;for(var oc=Lm(a),qb=0;qb<Wa;qb++)if(y[qb]){yb=y[qb].length;for(var be=a.getRowDefinition(qb),Kc=be.actual=0;Kc<yb;Kc++)if(y[qb][Kc]){var Rf=a.getColumnDefinition(Kc);void 0===D[Kc]&&(Rf.actual=0,D[Kc]=!0);for(var sf=y[qb][Kc],Xe=sf.length,
Ih=0;Ih<Xe;Ih++){var Qc=sf[Ih];if(Qc.visible||Qc===oc){var Sf=1<Qc.rowSpan||1<Qc.columnSpan;Sf&&(qb<Pb||Kc<Pd||G.push(Qc));var tf=Qc.margin,ce=tf.right+tf.left,qk=tf.top+tf.bottom;var Zb=Rl(Qc,be,Rf,!1);var Tf=Qc.desiredSize,Qd=!isNaN(Tf.height),Ac=!isNaN(Tf.width)&&Qd;Sf||Zb===Mg||Ac||qb<Pb||Kc<Pd||(void 0!==T[Kc]||Zb!==Hd&&Zb!==jl||(T[Kc]=-1,T.count++),void 0!==P[qb]||Zb!==Hd&&Zb!==kl||(P[qb]=-1,P.count++),O.push(Qc));Qc.measure(Infinity,Infinity,0,0);if(!(qb<Pb||Kc<Pd)){var uf=Qc.measuredBounds,
id=Math.max(uf.width+ce,0),wg=Math.max(uf.height+qk,0);if(1===Qc.rowSpan&&(Zb===Mg||Zb===jl)){X=a.getRowDefinition(qb);var Jh=X.Bc();zb=Math.max(wg-X.actual,0);zb+Jh>Y&&(zb=Math.max(Y-Jh,0));var Nn=0===X.actual;X.actual=X.actual+zb;Y=Math.max(Y-(zb+(Nn?Jh:0)),0)}if(1===Qc.columnSpan&&(Zb===Mg||Zb===kl)){X=a.getColumnDefinition(Kc);var xg=X.Bc();zb=Math.max(id-X.actual,0);zb+xg>ba&&(zb=Math.max(ba-xg,0));var rk=0===X.actual;X.actual=X.actual+zb;ba=Math.max(ba-(zb+(rk?xg:0)),0)}Sf&&Qc.Nm()}}}}}Oa(D);
var pc=0,ad=0;h=a.columnCount;for(var tc=0;tc<h;tc++){var yg=a.vb[tc];void 0!==yg&&(pc+=yg.na,0!==yg.na&&(pc+=yg.Bc()))}h=a.rowCount;for(var Kh=0;Kh<h;Kh++){var vf=a.zb[Kh];void 0!==vf&&(ad+=vf.na,0!==vf.na&&(ad+=vf.Bc()))}ba=Math.max(b-pc,0);var Si=Y=Math.max(c-ad,0),ze=ba;h=O.length;for(var Ye=0;Ye<h;Ye++){var Bc=O[Ye],sk=a.getRowDefinition(Bc.row),On=a.getColumnDefinition(Bc.column),zg=Bc.measuredBounds,Qb=Bc.margin,Ag=Qb.right+Qb.left,tk=Qb.top+Qb.bottom;T[Bc.column]=0===On.actual&&void 0!==T[Bc.column]?
Math.max(zg.width+Ag,T[Bc.column]):null;P[Bc.row]=0===sk.actual&&void 0!==P[Bc.row]?Math.max(zg.height+tk,P[Bc.row]):null}var Ti=0,Bg=0,Uf;for(Uf in P)"count"!==Uf&&(Ti+=P[Uf]);for(Uf in T)"count"!==Uf&&(Bg+=T[Uf]);for(var rb=Hb.alloc(),Cg=0;Cg<h;Cg++){var Cc=O[Cg];if(Cc.visible||Cc===oc){var Rc=a.getRowDefinition(Cc.row),sb=a.getColumnDefinition(Cc.column),Rd=0;isFinite(sb.width)?Rd=sb.width:(isFinite(ba)&&null!==T[Cc.column]?0===Bg?Rd=sb.actual+ba:Rd=T[Cc.column]/Bg*ze:null!==T[Cc.column]?Rd=ba:
Rd=sb.actual||ba,Rd=Math.max(0,Rd-sb.Bc()));var Sd=0;isFinite(Rc.height)?Sd=Rc.height:(isFinite(Y)&&null!==P[Cc.row]?0===Ti?Sd=Rc.actual+Y:Sd=P[Cc.row]/Ti*Si:null!==P[Cc.row]?Sd=Y:Sd=Rc.actual||Y,Sd=Math.max(0,Sd-Rc.Bc()));rb.h(Math.max(sb.minimum,Math.min(Rd,sb.maximum)),Math.max(Rc.minimum,Math.min(Sd,Rc.maximum)));Zb=Rl(Cc,Rc,sb,!1);switch(Zb){case jl:rb.height=Math.max(rb.height,Rc.actual+Y);break;case kl:rb.width=Math.max(rb.width,sb.actual+ba)}var de=Cc.margin,Pn=de.right+de.left,Lh=de.top+
de.bottom;Cc.Nm();Cc.measure(rb.width,rb.height,sb.minimum,Rc.minimum);var Mh=Cc.measuredBounds,Nh=Math.max(Mh.width+Pn,0),Oh=Math.max(Mh.height+Lh,0);isFinite(ba)&&(Nh=Math.min(Nh,rb.width));isFinite(Y)&&(Oh=Math.min(Oh,rb.height));var Dg=0;Dg=Rc.actual;Rc.actual=Math.max(Rc.actual,Oh);zb=Rc.actual-Dg;Y=Math.max(Y-zb,0);Dg=sb.actual;sb.actual=Math.max(sb.actual,Nh);zb=sb.actual-Dg;ba=Math.max(ba-zb,0)}}Oa(O);var Td=Hb.alloc(),jd=La(),Ae=La();h=G.length;if(0!==h)for(var Rb=0;Rb<Wa;Rb++)if(y[Rb]){yb=
y[Rb].length;var Ui=a.getRowDefinition(Rb);jd[Rb]=Ui.actual;for(var kd=0;kd<yb;kd++)if(y[Rb][kd]){var Qn=a.getColumnDefinition(kd);Ae[kd]=Qn.actual}}for(var Be=0;Be<h;Be++){var ab=G[Be];if(ab.visible||ab===oc){var Ud=a.getRowDefinition(ab.row),Dc=a.getColumnDefinition(ab.column);rb.h(Math.max(Dc.minimum,Math.min(b,Dc.maximum)),Math.max(Ud.minimum,Math.min(c,Ud.maximum)));Zb=Rl(ab,Ud,Dc,!1);switch(Zb){case Hd:0!==Ae[Dc.index]&&(rb.width=Math.min(rb.width,Ae[Dc.index]));0!==jd[Ud.index]&&(rb.height=
Math.min(rb.height,jd[Ud.index]));break;case jl:0!==Ae[Dc.index]&&(rb.width=Math.min(rb.width,Ae[Dc.index]));break;case kl:0!==jd[Ud.index]&&(rb.height=Math.min(rb.height,jd[Ud.index]))}isFinite(Dc.width)&&(rb.width=Dc.width);isFinite(Ud.height)&&(rb.height=Ud.height);Td.h(0,0);for(var Ce=1;Ce<ab.rowSpan&&!(ab.row+Ce>=a.rowCount);Ce++)X=a.getRowDefinition(ab.row+Ce),zb=0,zb=Zb===Hd||Zb===kl?Math.max(X.minimum,0===jd[ab.row+Ce]?X.maximum:Math.min(jd[ab.row+Ce],X.maximum)):Math.max(X.minimum,isNaN(X.cd)?
X.maximum:Math.min(X.cd,X.maximum)),Td.height+=zb;for(var De=1;De<ab.columnSpan&&!(ab.column+De>=a.columnCount);De++)X=a.getColumnDefinition(ab.column+De),zb=0,zb=Zb===Hd||Zb===jl?Math.max(X.minimum,0===Ae[ab.column+De]?X.maximum:Math.min(Ae[ab.column+De],X.maximum)):Math.max(X.minimum,isNaN(X.cd)?X.maximum:Math.min(X.cd,X.maximum)),Td.width+=zb;rb.width+=Td.width;rb.height+=Td.height;var Ph=ab.margin,Qh=Ph.right+Ph.left,ee=Ph.top+Ph.bottom;ab.measure(rb.width,rb.height,f,g);for(var Ee=ab.measuredBounds,
Ze=Math.max(Ee.width+Qh,0),$e=Math.max(Ee.height+ee,0),Fe=0,Cd=0;Cd<ab.rowSpan&&!(ab.row+Cd>=a.rowCount);Cd++)X=a.getRowDefinition(ab.row+Cd),Fe+=X.total||0;if(Fe<$e){var Vf=$e-Fe,Eg=$e-Fe;if(null!==ab.spanAllocation)for(var Rn=ab.spanAllocation,Rh=0;Rh<ab.rowSpan&&!(0>=Vf)&&!(ab.row+Rh>=a.rowCount);Rh++){X=a.getRowDefinition(ab.row+Rh);var Vd=X.na||0,Fg=Rn(ab,X,Eg);F&&"number"!==typeof Fg&&v(ab+" spanAllocation does not return a number: "+Fg);X.actual=Math.min(X.maximum,Vd+Fg);X.na!==Vd&&(Vf-=X.na-
Vd)}for(;0<Vf;){var Sh=X.na||0;isNaN(X.height)&&X.maximum>Sh&&(X.actual=Math.min(X.maximum,Sh+Vf),X.na!==Sh&&(Vf-=X.na-Sh));if(0===X.index)break;X=a.getRowDefinition(X.index-1)}}for(var Th=0,uk=0;uk<ab.columnSpan&&!(ab.column+uk>=a.columnCount);uk++)X=a.getColumnDefinition(ab.column+uk),Th+=X.total||0;if(Th<Ze){var Vi=Ze-Th,qu=Ze-Th;if(null!==ab.spanAllocation)for(var ru=ab.spanAllocation,vk=0;vk<ab.columnSpan&&!(0>=Vi)&&!(ab.column+vk>=a.columnCount);vk++){X=a.getColumnDefinition(ab.column+vk);var Sn=
X.na||0,Tn=ru(ab,X,qu);F&&"number"!==typeof Tn&&v(ab+" spanAllocation does not return a number: "+Tn);X.actual=Math.min(X.maximum,Sn+Tn);X.na!==Sn&&(Vi-=X.na-Sn)}for(;0<Vi;){var wk=X.na||0;isNaN(X.width)&&X.maximum>wk&&(X.actual=Math.min(X.maximum,wk+Vi),X.na!==wk&&(Vi-=X.na-wk));if(0===X.index)break;X=a.getColumnDefinition(X.index-1)}}}}Oa(G);Hb.free(Td);Hb.free(rb);void 0!==jd&&Oa(jd);void 0!==Ae&&Oa(Ae);var Gg=0,Hg=0,xk=a.desiredSize,Ar=a.maxSize;Zb=yl(a,!0);var Wi=ad=pc=0,Xi=0;h=a.columnCount;
for(var yk=0;yk<h;yk++)void 0!==a.vb[yk]&&(X=a.getColumnDefinition(yk),isFinite(X.width)?(Wi+=X.width,Wi+=X.Bc()):Tm(X)===Um?(Wi+=X.na,Wi+=X.Bc()):0!==X.na&&(pc+=X.na,pc+=X.Bc()));isFinite(xk.width)?Gg=Math.min(xk.width,Ar.width):Gg=Zb!==Mg&&isFinite(b)?b:pc;Gg=Math.max(Gg,a.minSize.width);Gg=Math.max(Gg-Wi,0);for(var su=0===pc?1:Math.max(Gg/pc,1),Ak=0;Ak<h;Ak++)void 0!==a.vb[Ak]&&(X=a.getColumnDefinition(Ak),isFinite(X.width)||Tm(X)===Um||(X.actual=X.na*su),X.position=e.width,0!==X.na&&(e.width+=
X.na,e.width+=X.Bc()));h=a.rowCount;for(var Bk=0;Bk<h;Bk++)void 0!==a.zb[Bk]&&(X=a.getRowDefinition(Bk),isFinite(X.height)?(Xi+=X.height,Xi+=X.Bc()):Tm(X)===Um?(Xi+=X.na,Xi+=X.Bc()):0!==X.na&&(ad+=X.na,0!==X.na&&(ad+=X.Bc())));isFinite(xk.height)?Hg=Math.min(xk.height,Ar.height):Hg=Zb!==Mg&&isFinite(c)?c:ad;Hg=Math.max(Hg,a.minSize.height);Hg=Math.max(Hg-Xi,0);for(var tu=0===ad?1:Math.max(Hg/ad,1),Ck=0;Ck<h;Ck++)void 0!==a.zb[Ck]&&(X=a.getRowDefinition(Ck),isFinite(X.height)||Tm(X)===Um||(X.actual=
X.na*tu),X.position=e.height,0!==X.na&&(e.height+=X.na,0!==X.na&&(e.height+=X.Bc())));h=l.length;for(var Un=0;Un<h;Un++){var Dd=l[Un],Vn=0,Wn=0;Dd.type===V.TableRow?(Vn=e.width,X=a.getRowDefinition(Dd.row),Wn=X.actual):(X=a.getColumnDefinition(Dd.column),Vn=X.actual,Wn=e.height);Dd.measuredBounds.h(0,0,Vn,Wn);Aj(Dd,!1);y[Dd.row]||(y[Dd.row]=[]);y[Dd.row][Dd.column]||(y[Dd.row][Dd.column]=[]);y[Dd.row][Dd.column].push(Dd)}Oa(l);a.Up=y};
Sm.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding,f=e.left;e=e.top;for(var g=a.Up,h,k,l=g.length,m=0,n=0;n<l;n++)g[n]&&(m=Math.max(m,g[n].length));for(n=Math.min(a.topIndex,l-1);n!==l&&(void 0===a.zb[n]||0===a.zb[n].na);)n++;n=Math.min(n,l-1);n=-a.zb[n].position;for(h=Math.min(a.leftIndex,m-1);h!==m&&(void 0===a.vb[h]||0===a.vb[h].na);)h++;h=Math.min(h,m-1);for(var p=-a.vb[h].position,r=Hb.alloc(),q=0;q<l;q++)if(g[q]){m=g[q].length;var u=a.getRowDefinition(q);k=u.position+n+e;0!==u.na&&
(k+=u.Vv());for(var w=0;w<m;w++)if(g[q][w]){var y=a.getColumnDefinition(w);h=y.position+p+f;0!==y.na&&(h+=y.Vv());for(var z=g[q][w],B=z.length,D=0;D<B;D++){var G=z[D],O=G.measuredBounds,T=G instanceof V?G:null;if(null===T||T.type!==V.TableRow&&T.type!==V.TableColumn){r.h(0,0);for(var P=1;P<G.rowSpan&&!(q+P>=a.rowCount);P++)T=a.getRowDefinition(q+P),r.height+=T.total;for(P=1;P<G.columnSpan&&!(w+P>=a.columnCount);P++)T=a.getColumnDefinition(w+P),r.width+=T.total;var ba=y.na+r.width,Y=u.na+r.height;
P=h;T=k;var oa=ba,Ea=Y,X=h,Ma=k,Wa=ba,yb=Y;h+ba>c.width&&(Wa=Math.max(c.width-h,0));k+Y>c.height&&(yb=Math.max(c.height-k,0));var Va=G.alignment;if(Va.Ib()){Va=a.defaultAlignment;Va.cb()||(Va=Mc);var Pb=Va.x;var Pd=Va.y;var zb=Va.offsetX;Va=Va.offsetY;var oc=y.alignment,qb=u.alignment;oc.cb()&&(Pb=oc.x,zb=oc.offsetX);qb.cb()&&(Pd=qb.y,Va=qb.offsetY)}else Pb=Va.x,Pd=Va.y,zb=Va.offsetX,Va=Va.offsetY;if(isNaN(Pb)||isNaN(Pd))Pd=Pb=.5,Va=zb=0;oc=O.width;qb=O.height;var be=G.margin,Kc=be.left+be.right,
Rf=be.top+be.bottom,sf=Rl(G,u,y,!1);!isNaN(G.desiredSize.width)||sf!==Hd&&sf!==jl||(oc=Math.max(ba-Kc,0));!isNaN(G.desiredSize.height)||sf!==Hd&&sf!==kl||(qb=Math.max(Y-Rf,0));ba=G.maxSize;Y=G.minSize;oc=Math.min(ba.width,oc);qb=Math.min(ba.height,qb);oc=Math.max(Y.width,oc);qb=Math.max(Y.height,qb);ba=qb+Rf;P+=oa*Pb-(oc+Kc)*Pb+zb+be.left;T+=Ea*Pd-ba*Pd+Va+be.top;G.visible&&(rc(X,Ma,Wa,yb,P,T,O.width,O.height)?G.arrange(P,T,oc,qb):G.arrange(P,T,oc,qb,new L(X,Ma,Wa,yb)))}else G.Ml(),G.actualBounds.ka(),
oa=G.actualBounds,P=L.allocAt(oa.x,oa.y,oa.width,oa.height),oa.x=T.type===V.TableRow?f:h,oa.y=T.type===V.TableColumn?e:k,oa.width=O.width,oa.height=O.height,G.actualBounds.freeze(),zl(G,!1),jc(P,oa)||(O=G.part,null!==O&&(O.Zh(),G.wp(O))),L.free(P)}}}Hb.free(r);for(a=0;a<d;a++)c=b[a],f=c instanceof V?c:null,null===f||f.type!==V.TableRow&&f.type!==V.TableColumn||(f=c.actualBounds,c.naturalBounds.ka(),c.naturalBounds.h(0,0,f.width,f.height),c.naturalBounds.freeze())};function Vm(){this.name="Base"}
la(Vm,bm);Vm.prototype.measure=function(){};Vm.prototype.arrange=function(){};function Wm(){this.name="Base"}la(Wm,bm);Wm.prototype.measure=function(){};Wm.prototype.arrange=function(){};function Xm(){this.name="Base"}la(Xm,bm);
Xm.prototype.measure=function(a,b,c,d,e,f,g){1<d.length&&v("Viewbox Panel cannot contain more than one GraphObject.");d=d[0];d.Fa=1;d.Nm();d.measure(Infinity,Infinity,f,g);var h=d.measuredBounds,k=d.margin,l=k.right+k.left;k=k.top+k.bottom;if(isFinite(b)||isFinite(c)){var m=d.scale,n=h.width;h=h.height;var p=Math.max(b-l,0),r=Math.max(c-k,0),q=1;a.viewboxStretch===Og?0!==n&&0!==h&&(q=Math.min(p/n,r/h)):0!==n&&0!==h&&(q=Math.max(p/n,r/h));0===q&&(q=1E-4);d.Fa*=q;m!==d.scale&&(Aj(d,!0),d.measure(Infinity,
Infinity,f,g))}h=d.measuredBounds;e.width=isFinite(b)?b:Math.max(h.width+l,0);e.height=isFinite(c)?c:Math.max(h.height+k,0)};Xm.prototype.arrange=function(a,b,c){b=b[0];var d=b.measuredBounds,e=b.margin,f=Math.max(d.width+(e.right+e.left),0);e=Math.max(d.height+(e.top+e.bottom),0);var g=b.alignment;g.Ib()&&(g=a.defaultAlignment);g.cb()||(g=Mc);b.arrange(c.width*g.x-f*g.x+g.offsetX,c.height*g.y-e*g.y+g.offsetY,d.width,d.height)};function Ym(){this.name="Base"}la(Ym,bm);Ym.prototype.measure=function(){};
Ym.prototype.arrange=function(){};
Ym.prototype.hc=function(a,b,c){c=a.Mf()*c.scale;0>=c&&(c=1);var d=a.gridCellSize,e=d.width;d=d.height;var f=a.naturalBounds,g=a.actualBounds,h=f.width,k=f.height,l=Math.ceil(h/e),m=Math.ceil(k/d),n=a.gridOrigin;b.save();b.beginPath();b.rect(0,0,h,k);b.clip();for(var p=[],r=a.$.j,q=r.length,u=0;u<q;u++){var w=r[u],y=[];p.push(y);if(w.visible){var z=w.interval;if(!(0>z)){w=ik(w.figure);for(var B=0;B<q;B++)if(B!==u){var D=r[B];D.visible&&ik(D.figure)===w&&(D=D.interval,D>z&&y.push(D))}}}}r=a.$.j;q=
r.length;for(u=0;u<q;u++){var G=r[u];if(G.visible&&(y=G.interval,!(2>e*Math.abs(y)*c))){z=G.opacity;w=1;if(1!==z){if(0===z)continue;w=b.globalAlpha;b.globalAlpha=w*z}B=p[u];D=!1;var O=G.strokeDashArray;null!==O&&(D=!0,b.Tt(O,G.strokeDashOffset));if("LineV"===G.figure&&null!==G.stroke&&0<G.strokeWidth){b.lineWidth=G.strokeWidth;zi(a,b,G.stroke,!1,!1,f,g);b.beginPath();for(O=G=Math.floor(-n.x/e);O<=G+l;O++){var T=O*e+n.x;0<=T&&T<=h&&Zm(O,y,B)&&(b.moveTo(T,0),b.lineTo(T,k))}b.stroke()}else if("LineH"===
G.figure&&null!==G.stroke&&0<G.strokeWidth){b.lineWidth=G.strokeWidth;zi(a,b,G.stroke,!1,!1,f,g);b.beginPath();for(O=G=Math.floor(-n.y/d);O<=G+m;O++)T=O*d+n.y,0<=T&&T<=k&&Zm(O,y,B)&&(b.moveTo(0,T),b.lineTo(h,T));b.stroke()}else if("BarV"===G.figure&&null!==G.fill)for(zi(a,b,G.fill,!0,!1,f,g),G=G.width,isNaN(G)&&(G=e),T=O=Math.floor(-n.x/e);T<=O+l;T++){var P=T*e+n.x;0<=P&&P<=h&&Zm(T,y,B)&&b.fillRect(P,0,G,k)}else if("BarH"===G.figure&&null!==G.fill)for(zi(a,b,G.fill,!0,!1,f,g),G=G.height,isNaN(G)&&
(G=d),T=O=Math.floor(-n.y/d);T<=O+m;T++)P=T*d+n.y,0<=P&&P<=k&&Zm(T,y,B)&&b.fillRect(0,P,h,G);D&&b.Rt();1!==z&&(b.globalAlpha=w)}}b.restore();b.zc(!1)};function Zm(a,b,c){if(0>b)return 0===a%b;if(0!==a%b)return!1;b=c.length;for(var d=0;d<b;d++)if(0===a%c[d])return!1;return!0}function $m(){this.name="Base"}la($m,bm);
$m.prototype.measure=function(a,b,c,d,e){c=d.length;if(a instanceof Te||a instanceof R){var f=null,g=null,h=null;a instanceof R&&(g=f=a);a instanceof Te&&(h=a,f=h.adornedPart);if(f instanceof R){var k=f;if(0===c)gc(a.naturalBounds,0,0),a.measuredBounds.h(0,0,0,0);else{var l=a instanceof Te?null:f.path,m=f.routeBounds;b=a.Jg;b.h(0,0,m.width,m.height);var n=k.points;f=f.pointsCount;null!==h?h.Mk(!1):null!==g&&g.Mk(!1);var p=m.width,r=m.height;a.location.h(m.x,m.y);a.l.length=0;null!==l&&(an(a,p,r,l),
h=l.measuredBounds,b.Uc(h),a.l.push(h));h=Ib.alloc();for(var q=J.alloc(),u=J.alloc(),w=0;w<c;w++){var y=d[w];if(y!==l)if(y.isPanelMain&&y instanceof Yf){an(a,p,r,y);var z=y.measuredBounds;b.Uc(z);a.l.push(z)}else if(2>f)y.measure(Infinity,Infinity,0,0),z=y.measuredBounds,b.Uc(z),a.l.push(z);else{var B=y.segmentIndex,D=y.segmentFraction,G=y.alignmentFocus;G.Sb()&&(G=Mc);var O=y.segmentOrientation,T=y.segmentOffset;if(isNaN(B)){var P=k.ua;z=La();P.lw(D,z);var ba=J.allocAt(z[0],z[1]);ba.add(k.i(0));
P.type===Id?ba.offset(-P.startX,-P.startY):(P=P.figures.first(),ba.offset(-P.startX,-P.startY));P=z[2];if(O!==og){var Y=k.computeAngle(y,O,P);y.dc=Y}Y=ba.x-m.x;var oa=ba.y-m.y;J.free(ba);Oa(z)}else if(B<-f||B>=f)oa=k.midPoint,P=k.midAngle,O!==og&&(Y=k.computeAngle(y,O,P),y.dc=Y),Y=oa.x-m.x,oa=oa.y-m.y;else{Y=0;0<=B?(oa=n.O(B),z=B<f-1?n.O(B+1):oa):(Y=f+B,oa=n.O(Y),z=0<Y?n.O(Y-1):oa);if(oa.Ta(z)){0<=B?(P=0<B?n.O(B-1):oa,Y=B<f-2?n.O(B+2):z):(P=Y<f-1?n.O(Y+1):oa,Y=1<Y?n.O(Y-2):z);ba=P.Se(oa);var Ea=z.Se(Y);
P=ba>Ea+10?0<=B?P.Xa(oa):oa.Xa(P):Ea>ba+10?0<=B?z.Xa(Y):Y.Xa(z):0<=B?P.Xa(Y):Y.Xa(P)}else P=0<=B?oa.Xa(z):z.Xa(oa);O!==og&&(Y=k.computeAngle(y,O,P),y.dc=Y);Y=oa.x+(z.x-oa.x)*D-m.x;oa=oa.y+(z.y-oa.y)*D-m.y}y.measure(Infinity,Infinity,0,0);z=y.measuredBounds;ba=y.naturalBounds;var X=0;y instanceof Yf&&(X=y.strokeWidth);Ea=ba.width+X;var Ma=ba.height+X;h.reset();h.translate(-z.x,-z.y);h.scale(y.scale,y.scale);h.rotate(O===og?y.angle:P,Ea/2,Ma/2);O!==bn&&O!==cn||h.rotate(90,Ea/2,Ma/2);O!==dn&&O!==en||
h.rotate(-90,Ea/2,Ma/2);O===fn&&(45<P&&135>P||225<P&&315>P)&&h.rotate(-P,Ea/2,Ma/2);ba=new L(0,0,Ea,Ma);q.Ej(ba,G);h.ya(q);G=-q.x+X/2*y.scale;y=-q.y+X/2*y.scale;u.assign(T);X=isNaN(T.x);var Wa=isNaN(T.y);if(X||Wa){Ea=Ea/2+3;Ma=Ma/2+3;var yb=45<=P&&135>=P,Va=225<=P&&315>=P;O===og&&(yb||Va)?(u.x=Wa?Ea:T.y,u.y=X?Ma:T.x,yb?0<=B||isNaN(B)&&.5>D||!X||(u.y=-Ma):Va&&((0<=B||isNaN(B)&&.5>D)&&X&&(u.y=-Ma),Wa&&(u.x=-Ea))):(X&&(u.x=0<=B||isNaN(B)&&.5>D?Ea:-Ea),Wa&&(u.y=-Ma),u.rotate(P))}else u.rotate(P);Y+=u.x;
oa+=u.y;ba.set(z);ba.h(Y+G,oa+y,z.width,z.height);a.l.push(ba);b.Uc(ba)}}if(null!==g)for(d=g.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.Jg=b;a=a.location;a.h(a.x+b.x,a.y+b.y);gc(e,b.width||0,b.height||0);Ib.free(h);J.free(q);J.free(u)}}}};
$m.prototype.arrange=function(a,b){var c=b.length;if(a instanceof Te||a instanceof R){var d=null,e=null,f=null;a instanceof R&&(e=d=a);a instanceof Te&&(f=a,d=f.adornedPart);var g=a instanceof Te?null:d.path;if(0!==a.l.length){var h=a.l,k=0;if(null!==g&&k<a.l.length){var l=h[k];k++;g.arrange(l.x-a.Jg.x,l.y-a.Jg.y,l.width,l.height)}for(l=0;l<c;l++){var m=b[l];if(m!==g&&k<a.l.length){var n=h[k];k++;m.arrange(n.x-a.Jg.x,n.y-a.Jg.y,n.width,n.height)}}}b=d.points;c=b.count;if(2<=c&&a instanceof R)for(d=
a.labelNodes;d.next();){var p=a;g=d.value;h=g.segmentIndex;k=g.segmentFraction;var r=g.alignmentFocus;l=g.segmentOrientation;m=g.segmentOffset;if(isNaN(h)){n=p.ua;var q=La();n.lw(k,q);var u=J.allocAt(q[0],q[1]);u.add(p.i(0));n.type===Id?u.offset(-n.startX,-n.startY):(n=n.figures.first(),u.offset(-n.startX,-n.startY));n=q[2];l!==og&&(p=p.computeAngle(g,l,n),g.angle=p);p=u.x;var w=u.y;J.free(u);Oa(q)}else if(h<-c||h>=c)w=p.midPoint,n=p.midAngle,l!==og&&(p=p.computeAngle(g,l,n),g.angle=p),p=w.x,w=w.y;
else{u=0;0<=h?(q=b.j[h],w=h<c-1?b.j[h+1]:q):(u=c+h,q=b.j[u],w=0<u?b.j[u-1]:q);if(q.Ta(w)){0<=h?(n=0<h?b.j[h-1]:q,u=h<c-2?b.j[h+2]:w):(n=u<c-1?b.j[u+1]:q,u=1<u?b.j[u-2]:w);var y=n.Se(q),z=w.Se(u);n=y>z+10?0<=h?n.Xa(q):q.Xa(n):z>y+10?0<=h?w.Xa(u):u.Xa(w):0<=h?n.Xa(u):u.Xa(n)}else n=0<=h?q.Xa(w):w.Xa(q);l!==og&&(p=p.computeAngle(g,l,n),g.angle=p);p=q.x+(w.x-q.x)*k;w=q.y+(w.y-q.y)*k}if(r.ar())g.location=new J(p,w);else{r.Sb()&&(r=Mc);q=Ib.alloc();q.reset();q.scale(g.scale,g.scale);q.rotate(g.angle,0,
0);var B=g.naturalBounds;u=L.allocAt(0,0,B.width,B.height);y=J.alloc();y.Ej(u,r);q.ya(y);r=-y.x;z=-y.y;var D=B.width,G=B.height;B=J.alloc();B.assign(m);var O=isNaN(m.x),T=isNaN(m.y);if(O||T){D=D/2+3;G=G/2+3;var P=45<=n&&135>=n,ba=225<=n&&315>=n;l===og&&(P||ba)?(B.x=T?D:m.y,B.y=O?G:m.x,P?0<=h||isNaN(h)&&.5>k||!O||(B.y=-G):ba&&((0<=h||isNaN(h)&&.5>k)&&O&&(B.y=-G),T&&(B.x=-D))):(O&&(B.x=0<=h||isNaN(h)&&.5>k?D:-D),T&&(B.y=-G),B.rotate(n))}else B.rotate(n);p+=B.x;w+=B.y;q.bx(u);r+=u.x;z+=u.y;h=J.allocAt(p+
r,w+z);g.move(h);J.free(h);J.free(B);J.free(y);L.free(u);Ib.free(q)}}null!==f?f.Mk(!1):null!==e&&e.Mk(!1)}};
function an(a,b,c,d){if(!1!==Fj(d)){var e=d.strokeWidth;0===e&&a instanceof Te&&a.type===V.Link&&a.adornedObject instanceof Yf&&(e=a.adornedObject.strokeWidth);e*=d.Fa;a instanceof R&&null!==a.ua?(a=a.ua.bounds,vl(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):a instanceof Te&&null!==a.adornedPart.ua?(a=a.adornedPart.ua.bounds,vl(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):vl(d,-(e/2),-(e/2),b+e,c+e);Aj(d,!1)}}function gn(){this.name="Base"}la(gn,bm);
gn.prototype.measure=function(a,b,c,d,e,f,g){var h=a.ub();a.oh=[];var k=h.margin,l=k.right+k.left,m=k.top+k.bottom;h.measure(b,c,f,g);var n=h.measuredBounds,p=new L(-k.left,-k.top,Math.max(n.width+l,0),Math.max(n.height+m,0));a.oh.push(p);e.assign(p);for(var r=h.geometry,q=h.strokeWidth,u=r.flattenedSegments,w=r.flattenedLengths,y=r.flattenedTotalLength,z=u.length,B=0,D=0,G=La(),O=0;O<z;O++){var T=u[O],P=[];D=B=0;for(var ba=T.length,Y=0;Y<ba;Y+=2){var oa=T[Y],Ea=T[Y+1];if(0!==Y){var X=180*Math.atan2(Ea-
D,oa-B)/Math.PI;0>X&&(X+=360);P.push(X)}B=oa;D=Ea}G.push(P)}if(null===a.ph){for(var Ma=[],Wa=a.$.j,yb=Wa.length,Va=0;Va<yb;Va++){var Pb=Wa[Va],Pd=[];Ma.push(Pd);if(Pb.visible){var zb=Pb.interval;if(!(0>zb))for(var oc=0;oc<yb;oc++)if(oc!==Va){var qb=Wa[oc];if(qb.visible&&Pb.constructor===qb.constructor){var be=qb.interval;be>zb&&Pd.push(be)}}}}a.ph=Ma}var Kc=a.ph;var Rf=a.$.j,sf=Rf.length,Xe=0,Ih=0,Qc=y;a.Vj=[];for(var Sf,tf=0;tf<sf;tf++){var ce=Rf[tf];Sf=[];if(ce.visible&&ce!==h){var qk=Math.abs(ce.interval),
Zb=a.graduatedTickUnit;if(!(2>Zb*qk*y/a.graduatedRange)){var Tf=w[0][0],Qd=0,Ac=0;Ih=y*ce.graduatedStart-1E-4;Qc=y*ce.graduatedEnd+1E-4;var uf=Zb*qk,id=a.graduatedTickBase;if(id<a.graduatedMin){var wg=(a.graduatedMin-id)/uf;wg=0===wg%1?wg:Math.floor(wg+1);id+=wg*uf}else id>a.graduatedMin+uf&&(id-=Math.floor((id-a.graduatedMin)/uf)*uf);for(var Jh=Kc[tf];id<=a.graduatedMax;){a:{for(var Nn=Jh.length,xg=0;xg<Nn;xg++)if(K.ca((id-a.graduatedTickBase)%(Jh[xg]*a.graduatedTickUnit),0)){var rk=!1;break a}rk=
!0}if(rk&&(null===ce.graduatedSkip||!ce.graduatedSkip(id))&&(Xe=(id-a.graduatedMin)*y/a.graduatedRange,Xe>y&&(Xe=y),Ih<=Xe&&Xe<=Qc)){for(var pc=G[Qd][Ac],ad=w[Qd][Ac];Qd<w.length;){for(;Xe>Tf&&Ac<w[Qd].length-1;)Ac++,pc=G[Qd][Ac],ad=w[Qd][Ac],Tf+=ad;if(Xe<=Tf)break;Qd++;Ac=0;pc=G[Qd][Ac];ad=w[Qd][Ac];Tf+=ad}var tc=u[Qd],yg=tc[2*Ac],Kh=tc[2*Ac+1],vf=(Xe-(Tf-ad))/ad,Si=new J(yg+(tc[2*Ac+2]-yg)*vf+q/2-r.bounds.x,Kh+(tc[2*Ac+3]-Kh)*vf+q/2-r.bounds.y);Si.scale(h.scale,h.scale);var ze=pc,Ye=G[Qd];1E-4>
vf?0<Ac?ze=Ye[Ac-1]:K.ca(tc[0],tc[tc.length-2])&&K.ca(tc[1],tc[tc.length-1])&&(ze=Ye[Ye.length-1]):.9999<vf&&(Ac+1<Ye.length?ze=Ye[Ac+1]:K.ca(tc[0],tc[tc.length-2])&&K.ca(tc[1],tc[tc.length-1])&&(ze=Ye[0]));pc!==ze&&(180<Math.abs(pc-ze)&&(pc<ze?pc+=360:ze+=360),pc=(pc+ze)/2%360);if(ce instanceof ih){var Bc="";null!==ce.graduatedFunction?(Bc=ce.graduatedFunction(id),Bc=null!==Bc&&void 0!==Bc?Bc.toString():""):Bc=(+id.toFixed(2)).toString();""!==Bc&&Sf.push({Xm:Si,angle:pc,text:Bc})}else Sf.push({Xm:Si,
angle:pc})}id+=uf}}}a.Vj.push(Sf)}Oa(G);var sk=a.Vj;if(null!==sk)for(var On=d.length,zg=0;zg<On;zg++){var Qb=d[zg],Ag=sk[zg];if(Qb.visible&&Qb!==h&&0!==Ag.length){if(Qb instanceof Yf){var tk=a,Ti=e,Bg=Qb.alignmentFocus;Bg.Sb()&&(Bg=Ic);var Uf=Qb.angle;Qb.dc=0;Qb.measure(Infinity,Infinity,0,0);Qb.dc=Uf;var rb=Qb.measuredBounds,Cg=rb.width,Cc=rb.height,Rc=L.allocAt(0,0,Cg,Cc),sb=J.alloc();sb.Ej(Rc,Bg);L.free(Rc);for(var Rd=-sb.x,Sd=-sb.y,de=new L,Pn=Ag.length,Lh=0;Lh<Pn;Lh++)for(var Mh=Ag[Lh],Nh=Mh.Xm.x,
Oh=Mh.Xm.y,Dg=Mh.angle,Td=0;4>Td;Td++){switch(Td){case 0:sb.h(Rd,Sd);break;case 1:sb.h(Rd+Cg,Sd);break;case 2:sb.h(Rd,Sd+Cc);break;case 3:sb.h(Rd+Cg,Sd+Cc)}sb.rotate(Dg+Qb.angle);sb.offset(Nh,Oh);0===Lh&&0===Td?de.h(sb.x,sb.y,0,0):de.Ze(sb);sb.offset(-Nh,-Oh);sb.rotate(-Dg-Qb.angle)}J.free(sb);null!==tk.oh&&tk.oh.push(de);qc(Ti,de.x,de.y,de.width,de.height)}else if(Qb instanceof ih){var jd=a,Ae=e;null===jd.Kh&&(jd.Kh=new ih);var Rb=jd.Kh;hn(Rb,Qb);var Ui=Qb.alignmentFocus;Ui.Sb()&&(Ui=Ic);for(var kd=
Qb.segmentOrientation,Qn=Qb.segmentOffset,Be=new L,ab=0,Ud=0,Dc=0,Ce=0,De=0,Ph=Ag.length,Qh=0;Qh<Ph;Qh++){var ee=Ag[Qh];ab=ee.Xm.x;Ud=ee.Xm.y;Dc=ee.angle;De=Ce=Qb.angle;kd!==og&&(De=kd===jn||kd===kn?Dc+Qb.angle:Dc,Ce=R.computeAngle(kd,De));Rb.dc=Ce;Rb.text=ee.text||"";Rb.measure(Infinity,Infinity,0,0);var Ee=Rb.measuredBounds,Ze=Rb.naturalBounds,$e=Ze.width,Fe=Ze.height,Cd=Ib.alloc();Cd.reset();Cd.translate(-Ee.x,-Ee.y);Cd.scale(Rb.scale,Rb.scale);Cd.rotate(De,$e/2,Fe/2);kd!==bn&&kd!==cn||Cd.rotate(90,
$e/2,Fe/2);kd!==dn&&kd!==en||Cd.rotate(-90,$e/2,Fe/2);kd===fn&&(45<Dc&&135>Dc||225<Dc&&315>Dc)&&Cd.rotate(-Dc,$e/2,Fe/2);var Vf=L.allocAt(0,0,$e,Fe),Eg=J.alloc();Eg.Ej(Vf,Ui);Cd.ya(Eg);var Rn=-Eg.x,Rh=-Eg.y,Vd=J.alloc();Vd.assign(Qn);isNaN(Vd.x)&&(Vd.x=$e/2+3);isNaN(Vd.y)&&(Vd.y=-(Fe/2+3));Vd.rotate(Dc);ab+=Vd.x+Rn;Ud+=Vd.y+Rh;var Fg=new L(ab,Ud,Ee.width,Ee.height),Sh=new L(Ee.x,Ee.y,Ee.width,Ee.height),Th=new L(Ze.x,Ze.y,Ze.width,Ze.height);ee.TA=Ce;ee.lineCount=Rb.lineCount;ee.lines=[Rb.xb,Rb.Oi,
Rb.ue,Rb.Ie,Rb.Vb,Rb.ob,Rb.se];ee.actualBounds=Fg;ee.measuredBounds=Sh;ee.naturalBounds=Th;0===Qh?Be.assign(Fg):Be.Uc(Fg);J.free(Vd);J.free(Eg);L.free(Vf);Ib.free(Cd)}null!==jd.oh&&jd.oh.push(Be);qc(Ae,Be.x,Be.y,Be.width,Be.height)}Aj(Qb,!1)}}};
gn.prototype.arrange=function(a,b,c){if(null!==a.oh){var d=a.ub(),e=a.Vj;if(null!==e){var f=a.oh,g=0,h=f[g];g++;null!==d&&d.arrange(h.x-c.x,h.y-c.y,h.width,h.height);for(var k=b.length,l=0;l<k;l++){var m=b[l];h=e[l];m.visible&&m!==d&&0!==h.length&&(h=f[g],g++,m.arrange(h.x-c.x,h.y-c.y,h.width,h.height))}a.oh=null}}};
gn.prototype.hc=function(a,b,c){var d=c.Ii;c.Ii=!0;var e=a.naturalBounds,f=e.width;e=e.height;b.save();b.beginPath();b.rect(-1,-1,f+1,e+1);b.clip();f=a.ub();f.hc(b,c);e=a.Mf()*c.scale;0>=e&&(e=1);for(var g=f.actualBounds,h=a.$.j,k=a.Vj,l=h.length,m=0;m<l;m++){var n=h[m],p=k[m],r=p.length;if(n.visible&&n!==f&&0!==p.length)if(n instanceof Yf){if(!(2>a.graduatedTickUnit*n.interval*f.geometry.flattenedTotalLength/a.graduatedRange*e)){var q=n.measuredBounds,u=n.strokeWidth*n.scale,w=n.alignmentFocus;w.Sb()&&
(w=Ic);for(var y=0;y<r;y++){var z=p[y].Xm,B=p[y].angle,D=w,G=n.tb;G.reset();G.translate(z.x+g.x,z.y+g.y);G.rotate(B+n.angle,0,0);G.translate(-q.width*D.x+D.offsetX+u/2,-q.height*D.y+D.offsetY+u/2);G.scale(n.scale,n.scale);Ol(n,!1);n.ji.set(n.tb);n.vl=n.scale;Pl(n,!1);n.hc(b,c);n.tb.reset()}}}else if(n instanceof ih)for(null===a.Kh&&(a.Kh=new ih),q=a.Kh,hn(q,n),n=0;n<r;n++)u=p[n],u.actualBounds&&u.measuredBounds&&u.naturalBounds&&(q.Zb=u.text||"",q.dc=u.TA||0,q.ad=u.lineCount||0,w=u.lines,void 0!==
w&&(q.xb=w[0],q.Oi=w[1],q.ue=w[2],q.Ie=w[3],q.Vb=w[4],q.ob=w[5],q.se=w[6]),u.naturalBounds&&(q.vc=u.naturalBounds),u.actualBounds&&(w=u.actualBounds,q.arrange(w.x,w.y,w.width,w.height)),w=u.actualBounds,q.arrange(w.x,w.y,w.width,w.height),y=u.measuredBounds,u=u.naturalBounds,z=q.tb,z.reset(),z.translate(w.x+g.x,w.y+g.y),z.translate(-y.x,-y.y),wl(q,z,u.x,u.y,u.width,u.height),Ol(q,!1),q.ji.set(q.tb),q.vl=q.scale,Pl(q,!1),q.hc(b,c))}c.Ii=d;b.restore();b.zc(!0)};
function V(a){N.call(this);void 0===a?this.sa=V.Position:(x(a,bm,V,"type"),this.sa=a);null===this.sa&&v("Panel type not specified or PanelLayout not loaded: "+a);this.$=new H;this.mb=Ec;this.sa===V.Grid&&(this.isAtomic=!0);this.Yn=ld;this.cg=il;this.sa===V.Table&&ln(this);this.Aq=Og;this.yo=ac;this.zo=Ob;this.vo=0;this.uo=100;this.xo=10;this.wo=0;this.xi=this.qb=this.ph=this.oh=this.Vj=null;this.Mo=NaN;this.ze=this.Mi=null;this.Ql="category";this.Xd=null;this.Jg=new L(NaN,NaN,NaN,NaN);this.Kh=this.Up=
this.ej=null;this.Xg=""}la(V,N);function ln(a){a.Oj=Ec;a.gh=1;a.Di=null;a.Ci=null;a.fh=1;a.eh=null;a.Bi=null;a.zb=[];a.vb=[];a.mk=mn;a.Lj=mn;a.hj=0;a.Qi=0}
V.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.sa=this.sa;a.mb=this.mb.J();a.Yn=this.Yn.J();a.cg=this.cg;if(a.sa===V.Table){a.Oj=this.Oj.J();a.gh=this.gh;a.Di=this.Di;a.Ci=this.Ci;a.fh=this.fh;a.eh=this.eh;a.Bi=this.Bi;var b=[];if(0<this.zb.length)for(var c=this.zb,d=c.length,e=0;e<d;e++)if(void 0!==c[e]){var f=c[e].copy();f.Dj(a);b[e]=f}a.zb=b;b=[];if(0<this.vb.length)for(c=this.vb,d=c.length,e=0;e<d;e++)void 0!==c[e]&&(f=c[e].copy(),f.Dj(a),b[e]=f);a.vb=b;a.mk=
this.mk;a.Lj=this.Lj;a.hj=this.hj;a.Qi=this.Qi}a.Aq=this.Aq;a.yo=this.yo.J();a.zo=this.zo.J();a.vo=this.vo;a.uo=this.uo;a.xo=this.xo;a.wo=this.wo;a.Vj=this.Vj;a.ph=this.ph;a.qb=this.qb;a.xi=this.xi;a.Mo=this.Mo;a.Mi=this.Mi;a.ze=this.ze;a.Ql=this.Ql;a.Jg.assign(this.Jg);a.Xg=this.Xg;null!==this.Up&&(a.Up=this.Up)};V.prototype.Kf=function(a){N.prototype.Kf.call(this,a);a.$=this.$;for(var b=a.$.j,c=b.length,d=0;d<c;d++)b[d].Ag=a;a.ej=null};
V.prototype.copy=function(){var a=N.prototype.copy.call(this);if(null!==a){for(var b=this.$.j,c=b.length,d=0;d<c;d++){var e=b[d].copy();e.Dj(a);e.jk=null;var f=a.$,g=f.count;f.Ab(g,e);f=a.part;if(null!==f){f.fk=null;null!==e.portId&&f instanceof U&&(f.Yh=!0);var h=a.diagram;null!==h&&h.undoManager.isUndoingRedoing||f.hb(Je,"elements",a,null,e,null,g)}}return a}return null};t=V.prototype;t.toString=function(){return"Panel("+this.type+")#"+pb(this)};
t.wp=function(a){N.prototype.wp.call(this,a);for(var b=this.$.j,c=b.length,d=0;d<c;d++)b[d].wp(a)};
t.pj=function(a,b){if(this.sa===V.Grid)this.sa.hc(this,a,b);else if(this.sa===V.Graduated)this.sa.hc(this,a,b);else{this.sa===V.Table&&(a.lineCap="butt",nn(this,a,!0,this.zb,!0),nn(this,a,!1,this.vb,!0),on(this,a,!0,this.zb),on(this,a,!1,this.vb),nn(this,a,!0,this.zb,!1),nn(this,a,!1,this.vb,!1));var c=this.isClipping&&this.sa===V.Spot;c&&a.save();for(var d=this.ub(),e=this.$.j,f=e.length,g=0;g<f;g++){var h=e[g];c&&h===d&&(a.clipInsteadOfFill=!0);h.hc(a,b);c&&h===d&&(a.clipInsteadOfFill=!1)}c&&(a.restore(),
a.zc(!0))}};
function on(a,b,c,d){for(var e=d.length,f=a.actualBounds,g=a.naturalBounds,h=!0,k=0;k<e;k++){var l=d[k];if(void 0!==l)if(h)h=!1;else if(0!==l.actual){if(c){if(l.position>f.height)continue}else if(l.position>f.width)continue;var m=l.separatorStrokeWidth;isNaN(m)&&(m=c?a.gh:a.fh);var n=l.separatorStroke;null===n&&(n=c?a.Di:a.eh);if(0!==m&&null!==n){zi(a,b,n,!1,!1,g,f);n=!1;var p=l.separatorDashArray;null===p&&(p=c?a.Ci:a.Bi);null!==p&&(n=!0,b.Tt(p,0));b.beginPath();p=l.position+m;c?p>f.height&&(m-=
p-f.height):p>f.width&&(m-=p-f.width);l=l.position+m/2;b.lineWidth=m;m=a.mb;c?(l+=m.top,p=f.width-m.right,b.moveTo(m.left,l),b.lineTo(p,l)):(l+=m.left,p=f.height-m.bottom,b.moveTo(l,m.top),b.lineTo(l,p));b.stroke();n&&b.Rt()}}}}
function nn(a,b,c,d,e){for(var f=d.length,g=a.actualBounds,h=a.naturalBounds,k=0;k<f;k++){var l=d[k];if(void 0!==l&&null!==l.background&&l.coversSeparators!==e&&0!==l.actual){var m=c?g.height:g.width;if(!(l.position>m)){var n=l.Bc(),p=l.separatorStrokeWidth;isNaN(p)&&(p=c?a.gh:a.fh);var r=l.separatorStroke;null===r&&(r=c?a.Di:a.eh);null===r&&(p=0);n-=p;p=l.position+p;n+=l.actual;p+n>m&&(n=m-p);0>=n||(m=a.mb,zi(a,b,l.background,!0,!1,h,g),c?b.fillRect(m.left,p+m.top,g.width-(m.left+m.right),n):b.fillRect(p+
m.left,m.top,n,g.height-(m.top+m.bottom)))}}}}function ik(a){return"LineV"===a||"BarV"===a}
t.Hk=function(a,b,c,d,e){var f=this.le(),g=this.transform,h=1/(g.m11*g.m22-g.m12*g.m21),k=g.m22*h,l=-g.m12*h,m=-g.m21*h,n=g.m11*h,p=h*(g.m21*g.dy-g.m22*g.dx),r=h*(g.m12*g.dx-g.m11*g.dy);if(null!==this.areaBackground)return g=this.actualBounds,K.hd(g.left,g.top,g.right,g.bottom,a,b,c,d,e);if(null!==this.background)return f=a*k+b*m+p,h=a*l+b*n+r,a=c*k+d*m+p,k=c*l+d*n+r,e.h(0,0),c=this.naturalBounds,f=K.hd(0,0,c.width,c.height,f,h,a,k,e),e.transform(g),f;f||(k=1,m=l=0,n=1,r=p=0);h=a*k+b*m+p;a=a*l+b*
n+r;k=c*k+d*m+p;c=c*l+d*n+r;e.h(k,c);d=(k-h)*(k-h)+(c-a)*(c-a);l=!1;n=this.$.j;r=n.length;m=J.alloc();p=null;b=Infinity;var q=null,u=this.isClipping&&this.sa===V.Spot;u&&(q=J.alloc(),p=this.ub(),(l=p.Hk(h,a,k,c,q))&&(b=(h-q.x)*(h-q.x)+(a-q.y)*(a-q.y)));for(var w=0;w<r;w++){var y=n[w];y.visible&&y!==p&&y.Hk(h,a,k,c,m)&&(l=!0,y=(h-m.x)*(h-m.x)+(a-m.y)*(a-m.y),y<d&&(d=y,e.set(m)))}u&&(b>d&&e.set(q),J.free(q));J.free(m);f&&e.transform(g);return l};
t.v=function(a){if(!0!==Fj(this)){N.prototype.v.call(this,a);a=null;if(this.sa===V.Auto||this.sa===V.Link)a=this.ub();for(var b=this.$.j,c=b.length,d=0;d<c;d++){var e=b[d];(e===a||e.isPanelMain)&&e.v(!0);if(!e.desiredSize.o()){var f=yl(e,!1);(e instanceof Kg||e instanceof V||e instanceof ih||f!==Mg)&&e.v(!0)}}}};t.Nm=function(){if(!1===Fj(this)){Aj(this,!0);zl(this,!0);for(var a=this.$.j,b=a.length,c=0;c<b;c++)a[c].Nm()}};
t.Ml=function(){if(0!==(this.I&2048)===!1){Ol(this,!0);Pl(this,!0);for(var a=this.$.j,b=a.length,c=0;c<b;c++)a[c].rw()}};t.rw=function(){Pl(this,!0);for(var a=this.$.j,b=a.length,c=0;c<b;c++)a[c].rw()};
t.Rm=function(a,b,c,d){var e=this.Jg;e.h(0,0,0,0);var f=this.desiredSize,g=this.minSize;void 0===c&&(c=g.width,d=g.height);c=Math.max(c,g.width);d=Math.max(d,g.height);var h=this.maxSize;isNaN(f.width)||(a=Math.min(f.width,h.width));isNaN(f.height)||(b=Math.min(f.height,h.height));a=Math.max(c,a);b=Math.max(d,b);var k=this.mb;a=Math.max(a-k.left-k.right,0);b=Math.max(b-k.top-k.bottom,0);var l=this.$.j;0!==l.length&&this.sa.measure(this,a,b,l,e,c,d);a=e.width+k.left+k.right;k=e.height+k.top+k.bottom;
isFinite(f.width)&&(a=f.width);isFinite(f.height)&&(k=f.height);a=Math.min(h.width,a);k=Math.min(h.height,k);a=Math.max(g.width,a);k=Math.max(g.height,k);a=Math.max(c,a);k=Math.max(d,k);gc(e,a,k);gc(this.naturalBounds,a,k);vl(this,0,0,a,k)};t.ub=function(){if(null===this.ej){var a=this.$.j,b=a.length;if(0===b)return null;for(var c=0;c<b;c++){var d=a[c];if(!0===d.isPanelMain)return this.ej=d}this.ej=a[0]}return this.ej};function Lm(a){return null!==a.part?a.part.locationObject:null}
t.Th=function(a,b,c,d){var e=this.$.j;this.actualBounds.h(a,b,c,d);if(0!==e.length){if(!this.desiredSize.o()){a=yl(this,!0);var f=this.measuredBounds;b=f.width;f=f.height;var g=this.uh,h=g.left+g.right;g=g.top+g.bottom;b===c&&f===d&&(a=Mg);switch(a){case Mg:if(b>c||f>d)this.v(),this.measure(b>c?c:b,f>d?d:f,0,0);break;case Hd:this.v(!0);this.measure(c+h,d+g,0,0);break;case jl:this.v(!0);this.measure(c+h,f+g,0,0);break;case kl:this.v(!0),this.measure(b+h,d+g,0,0)}}this.sa.arrange(this,e,this.Jg)}};
t.Vh=function(a){var b=this.naturalBounds,c=Lm(this);if(rc(0,0,b.width,b.height,a.x,a.y)){b=this.$.j;for(var d=b.length,e=J.allocAt(0,0);d--;){var f=b[d];if(f.visible||f===c)if(Jb(e.set(a),f.transform),f.fa(e))return J.free(e),!0}J.free(e);return null===this.pb&&null===this.jc?!1:!0}return!1};t.Ut=function(a){if(this.il===a)return this;for(var b=this.$.j,c=b.length,d=0;d<c;d++){var e=b[d].Ut(a);if(null!==e)return e}return null};
t.Yk=function(a,b){b(this,a);if(a instanceof V){a=a.$.j;for(var c=a.length,d=0;d<c;d++)this.Yk(a[d],b)}};function Sj(a,b){pn(a,a,b)}function pn(a,b,c){c(b);b=b.$.j;for(var d=b.length,e=0;e<d;e++){var f=b[e];f instanceof V&&pn(a,f,c)}}function qn(a,b){rn(a,a,b)}function rn(a,b,c){c(b);if(b instanceof V){b=b.$.j;for(var d=b.length,e=0;e<d;e++)rn(a,b[e],c)}}t.Gm=function(a){return sn(this,this,a)};
function sn(a,b,c){if(c(b))return b;if(b instanceof V){b=b.$.j;for(var d=b.length,e=0;e<d;e++){var f=sn(a,b[e],c);if(null!==f)return f}}return null}t.gb=function(a){if(this.name===a)return this;var b=this.$.j,c=b.length;null===this.Mi&&null===this.ze||(c=tn(this));for(var d=0;d<c;d++){var e=b[d];if(e instanceof V){var f=e.gb(a);if(null!==f)return f}if(e.name===a)return e}return null};
function un(a){a=a.$.j;for(var b=a.length,c=0,d=0;d<b;d++){var e=a[d];e instanceof V?c=Math.max(c,un(e)):e instanceof Yf&&(c=Math.max(c,e.Ih/2*e.qk*e.Mf()))}return c}t.le=function(){return!(this.type===V.TableRow||this.type===V.TableColumn)};
t.$b=function(a,b,c){if(!1===this.pickable)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(Gj(this))return null;var d=this.naturalBounds,e=1/this.Mf(),f=this.le(),g=f?a:Jb(J.allocAt(a.x,a.y),this.transform),h=this.diagram,k=10,l=5;null!==h&&(k=h.Lm("extraTouchArea"),l=k/2);if(rc(-(l*e),-(l*e),d.width+k*e,d.height+k*e,g.x,g.y)){if(!this.isAtomic){e=this.$.j;var m=e.length;h=J.alloc();l=(k=this.isClipping&&this.sa===V.Spot)?this.ub():null;if(k&&(l.le()?Jb(h.set(a),l.transform):h.set(a),!l.fa(h)))return J.free(h),
f||J.free(g),null;for(var n=Lm(this);m--;){var p=e[m];if(p.visible||p===n)if(p.le()?Jb(h.set(a),p.transform):h.set(a),!k||p!==l){var r=null;p instanceof V?r=p.$b(h,b,c):!0===p.pickable&&p.fa(h)&&(r=p);if(null!==r&&(null!==b&&(r=b(r)),null!==r&&(null===c||c(r))))return J.free(h),f||J.free(g),r}}J.free(h)}if(null===this.background&&null===this.areaBackground)return f||J.free(g),null;a=rc(0,0,d.width,d.height,g.x,g.y)?this:null;f||J.free(g);return a}f||J.free(g);return null};
t.sj=function(a,b,c,d){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var e=this.naturalBounds,f=this.le(),g=f?a:Jb(J.allocAt(a.x,a.y),this.transform),h=this.type===V.TableRow||this.type===V.TableColumn;e=rc(0,0,e.width,e.height,g.x,g.y);if(h||e){if(!this.isAtomic){h=this.$.j;for(var k=h.length,l=J.alloc(),m=Lm(this);k--;){var n=h[k];if(n.visible||n===m){n.le()?Jb(l.set(a),n.transform):l.set(a);var p=n;n=n instanceof V?n:null;(null!==n?n.sj(l,b,c,d):p.fa(l))&&!1!==p.pickable&&
(null!==b&&(p=b(p)),null===p||null!==c&&!c(p)||d.add(p))}}J.free(l)}f||J.free(g);return e&&(null!==this.background||null!==this.areaBackground)}f||J.free(g);return!1};
t.Lf=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var g=f;void 0===f&&(g=Ib.alloc(),g.reset());g.multiply(this.transform);if(this.Uh(a,g))return vn(this,b,c,e),void 0===f&&Ib.free(g),!0;if(this.Rc(a,g)){if(!this.isAtomic)for(var h=Lm(this),k=this.$.j,l=k.length;l--;){var m=k[l];if(m.visible||m===h){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=m;m=m instanceof V?m:null;p=Ib.alloc();p.set(g);
if(null!==m?m.Lf(a,b,c,d,e,p):xl(n,a,d,p))null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||e.add(n);Ib.free(p)}}}void 0===f&&Ib.free(g);return d}void 0===f&&Ib.free(g);return!1};function vn(a,b,c,d){for(var e=a.$.j,f=e.length;f--;){var g=e[f];if(g.visible){var h=g.actualBounds,k=a.naturalBounds;h.x>k.width||h.y>k.height||0>h.x+h.width||0>h.y+h.height||(g instanceof V&&vn(g,b,c,d),null!==b&&(g=b(g)),null===g||null!==c&&!c(g)||d.add(g))}}}
t.Qg=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===c&&(c=null);void 0===d&&(d=null);var g=this.naturalBounds,h=this.le(),k=h?a:Jb(J.allocAt(a.x,a.y),this.transform),l=h?b:Jb(J.allocAt(b.x,b.y),this.transform),m=k.Se(l),n=0<k.x&&k.x<g.width&&0<k.y&&k.y<g.height||Kb(k.x,k.y,0,0,0,g.height)<=m||Kb(k.x,k.y,0,g.height,g.width,g.height)<=m||Kb(k.x,k.y,g.width,g.height,g.width,0)<=m||Kb(k.x,k.y,g.width,0,0,0)<=m;g=k.qd(0,0)<=m&&k.qd(0,g.height)<=m&&k.qd(g.width,0)<=m&&k.qd(g.width,g.height)<=
m;h||(J.free(k),J.free(l));if(n){if(!this.isAtomic){k=J.alloc();l=J.alloc();m=Lm(this);for(var p=this.$.j,r=p.length;r--;){var q=p[r];if(q.visible||q===m){var u=q.actualBounds,w=this.naturalBounds;if(!h||!(u.x>w.width||u.y>w.height||0>u.x+u.width||0>u.y+u.height))if(q.le()?(u=q.transform,Jb(k.set(a),u),Jb(l.set(b),u)):(k.set(a),l.set(b)),u=q,q=q instanceof V?q:null,null!==q?q.Qg(k,l,c,d,e,f):u.Ey(k,l,e))null!==c&&(u=c(u)),null===u||null!==d&&!d(u)||f.add(u)}}J.free(k);J.free(l)}return e?n:g}return!1};
function Qm(a){var b=null;a instanceof Yf&&(b=a.spot1,b===ld&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot1));null===b&&(b=Hc);return b}function Rm(a){var b=null;a instanceof Yf&&(b=a.spot2,b===ld&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot2));null===b&&(b=Sc);return b}t.add=function(a){x(a,N,V,"add:element");this.Ab(this.$.count,a)};t.O=function(a){return this.$.O(a)};
t.Ab=function(a,b){b instanceof S&&v("Cannot add a Part to a Panel: "+b+"; use a Panel instead");if(this===b||this.Sg(b))this===b&&v("Cannot make a Panel contain itself: "+this.toString()),v("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+b.toString());var c=b.panel;null!==c&&c!==this&&v("Cannot add a GraphObject that already belongs to another Panel to this Panel: "+b.toString()+", already contained by "+c.toString()+", cannot be shared by this Panel: "+this.toString());
this.sa!==V.Grid||b instanceof Yf||v("Can only add Shapes to a Grid Panel, not: "+b);this.sa!==V.Graduated||b instanceof Yf||b instanceof ih||v("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.Dj(this);b.jk=null;if(null!==this.itemArray){var d=b.data;null!==d&&"object"===typeof d&&(null===this.Xd&&(this.Xd=new Db),this.Xd.add(d,b))}var e=this.$;d=-1;if(c===this){for(var f=-1,g=this.$.j,h=g.length,k=0;k<h;k++)if(g[k]===b){f=k;break}if(-1!==f){if(f===a||f+1>=e.count&&a>=e.count)return;
e.ib(f);d=f}else v("element "+b.toString()+" has panel "+c.toString()+" but is not contained by it.")}if(0>a||a>e.count)a=e.count;e.Ab(a,b);if(0===a||b.isPanelMain)this.ej=null;Fj(this)||this.v();b.v(!1);null!==b.portId?this.Yh=!0:b instanceof V&&!0===b.Yh&&(this.Yh=!0);this.ph=null;c=this.part;null!==c&&(c.fk=null,c.vh=NaN,this.Yh&&c instanceof U&&(c.Yh=!0),c.Yh&&c instanceof U&&(c.yc=null),e=this.diagram,null!==e&&e.undoManager.isUndoingRedoing||(-1!==d&&c.hb(Ke,"elements",this,b,null,d,null),c.hb(Je,
"elements",this,null,b,null,a),this.Tg()||wn(this,b,!1)))};function xn(a,b){a.I=b?a.I|16777216:a.I&-16777217}t.remove=function(a){x(a,N,V,"remove:element");for(var b=this.$.j,c=b.length,d=-1,e=0;e<c;e++)if(b[e]===a){d=e;break}-1!==d&&this.Qc(d,!0)};t.ib=function(a){F&&C(a,V,"removeAt:idx");0<=a&&this.Qc(a,!0)};
t.Qc=function(a,b){var c=this.$,d=c.O(a);d.jk=null;d.Dj(null);if(null!==this.Xd){var e=d.data;"object"===typeof e&&this.Xd.remove(e)}c.ib(a);Aj(this,!1);this.v();this.ej===d&&(this.ej=null);this.ph=null;var f=this.part;null!==f&&(f.fk=null,f.vh=NaN,f.Rb(),f instanceof U&&(d instanceof V?d.Yk(d,function(a,c){fm(f,c,b)}):fm(f,d,b)),c=this.diagram,null!==c&&c.undoManager.isUndoingRedoing||f.hb(Ke,"elements",this,d,null,a,null))};
V.prototype.getRowDefinition=function(a){F&&C(a,V,"getRowDefinition:idx");0>a&&ya(a,">= 0",V,"getRowDefinition:idx");a=Math.round(a);var b=this.zb;if(void 0===b)return null;if(void 0===b[a]){var c=new gk;c.Dj(this);c.isRow=!0;c.index=a;b[a]=c}return b[a]};V.prototype.Hw=function(a){F&&C(a,V,"removeRowDefinition:idx");0>a&&ya(a,">= 0",V,"removeRowDefinition:idx");a=Math.round(a);var b=this.zb;void 0!==b&&(this.hb(Ke,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.v())};
V.prototype.getColumnDefinition=function(a){F&&C(a,V,"getColumnDefinition:idx");0>a&&ya(a,">= 0",V,"getColumnDefinition:idx");a=Math.round(a);var b=this.vb;if(void 0===b)return null;if(void 0===b[a]){var c=new gk;c.Dj(this);c.isRow=!1;c.index=a;b[a]=c}return b[a]};t=V.prototype;t.Fw=function(a){F&&C(a,V,"removeColumnDefinition:idx");0>a&&ya(a,">= 0",V,"removeColumnDefinition:idx");a=Math.round(a);var b=this.vb;void 0!==b&&(this.hb(Ke,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.v())};
t.pA=function(a){if(0>a||this.type!==V.Table)return-1;for(var b=0,c=this.zb,d=c.length,e=this.hj;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};t.hA=function(a){if(0>a||this.type!==V.Table)return-1;for(var b=0,c=this.vb,d=c.length,e=this.Qi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};
t.FA=function(a,b){void 0===b&&(b=new J(NaN,NaN));if(this.type!==V.Graduated)return b.h(NaN,NaN),b;a=Math.min(Math.max(a,this.graduatedMin),this.graduatedMax);var c=this.ub();c.geometry.kw((a-this.graduatedMin)/this.graduatedRange,b);return c.transform.ya(b)};t.GA=function(a){if(this.type!==V.Graduated)return NaN;var b=this.ub();b.transform.ge(a);return b.geometry.Iy(a)*this.graduatedRange+this.graduatedMin};function Wl(a){a=a.xi;return null!==a&&a.s}
function Lg(a){var b=a.xi;if(null===b)null!==a.data&&v("Template cannot have .data be non-null: "+a),a.xi=b=new H;else if(b.s)return;var c=new H;xn(a,!1);a.Yk(a,function(a,d){var e=d.kb;if(null!==e)for(Tl(d,!1),e=e.iterator;e.next();){var f=e.value;f.mode===yn&&Tl(d,!0);var g=f.sourceName;null!==g&&("/"===g&&xn(a,!0),g=ul(f,a,d),null!==g&&(c.add(g),null===g.pm&&(g.pm=new H),g.pm.add(f)));b.add(f)}if(d instanceof V&&d.type===V.Table){if(0<d.zb.length)for(a=d.zb,e=a.length,f=0;f<e;f++)if(g=a[f],void 0!==
g&&null!==g.kb)for(var h=g.kb.iterator;h.next();){var k=h.value;k.pd=g;k.sq=2;k.vm=g.index;b.add(k)}if(0<d.vb.length)for(d=d.vb,a=d.length,e=0;e<a;e++)if(f=d[e],void 0!==f&&null!==f.kb)for(g=f.kb.iterator;g.next();)h=g.value,h.pd=f,h.sq=1,h.vm=f.index,b.add(h)}});for(var d=c.iterator;d.next();){var e=d.value;if(null!==e.pm){Tl(e,!0);for(var f=e.pm.iterator;f.next();){var g=f.value;null===e.kb&&(e.kb=new H);e.kb.add(g)}}e.pm=null}for(var h=b.iterator;h.next();)if(d=h.value,e=d.pd,null!==e){d.pd=null;
g=d.targetProperty;var k=g.indexOf(".");0<k&&e instanceof V&&(f=g.substring(0,k),g=g.substr(k+1),k=e.gb(f),null!==k?(e=k,d.targetProperty=g):Ca('Warning: unable to find GraphObject named "'+f+'" for Binding: '+d.toString()));e instanceof gk?(f=pb(e.panel),d.Hj=void 0===f?-1:f,e.panel.il=d.Hj):e instanceof N?(f=pb(e),d.Hj=void 0===f?-1:f,e.il=d.Hj):v("Unknown type of binding target: "+e)}b.freeze();a instanceof S&&(a.bc()&&a.Ya(),F&&!zn&&a.Yk(a,function(a,c){if(c instanceof V&&(c.type===V.Auto||c.type===
V.Spot||c.type===V.Graduated)&&1>=c.elements.count&&!(c instanceof S)){var d=!1;if(1===c.elements.count&&(d=null!==c.itemArray,!d))for(h=b.iterator;h.next();)if("itemArray"===h.value.targetProperty){d=!0;break}d||(Ca("Auto, Spot, or Graduated Panel should not have zero or one elements: "+c.toString()+" in "+a.toString()),zn=!0)}}))}
t.Sz=function(a){void 0===a&&(a=!1);var b=this.copy();qn(b,function(a){a instanceof V&&(a.xi=null,a.qb=null);var b=a.kb;null!==b&&(a.kb=null,b.each(function(b){a.bind(b.copy())}));b=a.Yg;null!==b&&(a.Yg=null,b.each(function(b){Xl(a,b.value.copy())}))});a&&Lg(b);return b};
t.Ha=function(a){var b=this.xi;if(null!==b)for(void 0===a&&(a=""),b=b.iterator;b.next();){var c=b.value,d=c.sourceProperty;if(""===a||""===d||d===a)if(d=c.targetProperty,null!==c.converter||""!==d){d=this.data;var e=c.sourceName;if(null!==e)d=""===e?this:"/"===e?this:"."===e?this:".."===e?this:this.gb(e);else{var f=this.diagram;null!==f&&c.isToModel&&(d=f.model.modelData)}if(null===d)F&&Ca("Binding error: missing GraphObject named "+e+" in "+this.toString());else{f=this;var g=c.Hj;if(-1!==g){if(f=
this.Ut(g),null===f)continue}else null!==c.pd&&(f=c.pd);"/"===e?d=f.part:"."===e?d=f:".."===e&&(d=f.panel);e=c.sq;if(0!==e){if(!(f instanceof V))continue;1===e?f=f.getColumnDefinition(c.vm):2===e&&(f=f.getRowDefinition(c.vm))}void 0!==f&&c.hx(f,d)}}}};
function An(a,b){a=a.$.j;for(var c=a.length,d=b.length,e=0,f=null;e<c&&!(f=a[e],f instanceof V&&null!==f.data);)e++,f=a[e];if(c-e!==d)return!0;if(null===f)return 0<d;for(var g=0;e<c&&g<d;){f=a[e];if(!(f instanceof V)||f.data!==b[g])return!0;e++;g++}return!1}
function tn(a){if(a.type===V.Spot||a.type===V.Auto)return Math.min(a.$.length,1);if(a.type===V.Link){a=a.$;for(var b=a.length,c=0;c<b;c++){var d=a.O(c);if(!(d instanceof Yf&&d.isPanelMain))break}return c}return a.type===V.Table&&0<a.$.length&&(a=a.$.O(0),a.isPanelMain&&a instanceof V&&(a.type===V.TableRow||a.type===V.TableColumn))?1:0}t.ru=function(){for(var a=tn(this);this.$.length>a;)this.Qc(this.$.length-1,!1);a=this.itemArray;if(null!==a)for(var b=a.length,c=0;c<b;c++)Bn(this,a[c],c)};
t.Dy=function(a){if(void 0===a||null===a||null===this.Xd)return null;A(a,"object",V,"findItemPanelForData");return this.Xd.K(a)};
function Bn(a,b,c){if(!(void 0===b||null===b||0>c)){var d=Cn(a,b),e=a.itemTemplateMap,f=null;null!==e&&(f=e.K(d));null===f&&(Dn||(Dn=!0,Ca('No item template Panel found for category "'+d+'" on '+a),Ca("  Using default item template."),d=new V,e=new ih,e.bind(new Yi("text","",Qa)),d.add(e),En=d),f=En);d=f;null!==d&&(Lg(d),d=d.copy(),0!==(d.I&16777216)&&(e=a.tj(),null!==e&&xn(e,!0)),"object"===typeof b&&(null===a.Xd&&(a.Xd=new Db),a.Xd.add(b,d)),e=c+tn(a),a.Ab(e,d),d.qb=b,Fn(a,e,c),d.qb=null,d.data=
b)}}function Fn(a,b,c){for(a=a.$;b<a.length;){var d=a.O(b);if(d instanceof V){var e=b,f=c;d.type===V.TableRow?d.row=e:d.type===V.TableColumn&&(d.column=e);d.itemIndex=f}b++;c++}}function Cn(a,b){if(null===b)return"";a=a.Ql;if("function"===typeof a)a=a(b);else if("string"===typeof a&&"object"===typeof b){if(""===a)return"";a=Gn(b,a)}else return"";if(void 0===a)return"";if("string"===typeof a)return a;v("Panel.getCategoryForItemData found a non-string category for "+b+": "+a);return""}
function wn(a,b,c){var d=b.enabledChanged;null!==d&&d(b,c);if(b instanceof V){b=b.$.j;d=b.length;for(var e=0;e<d;e++){var f=b[e];c&&f instanceof V&&!f.isEnabled||wn(a,f,c)}}}function Hn(a,b){b.name=a;am.add(a,b)}
ma.Object.defineProperties(V.prototype,{type:{configurable:!0,get:function(){return this.sa},set:function(a){var b=this.sa;b!==a&&(this.sa=a,this.sa===V.Grid?this.isAtomic=!0:this.sa===V.Table&&ln(this),this.v(),this.g("type",b,a))}},elements:{configurable:!0,get:function(){return this.$.iterator}},naturalBounds:{configurable:!0,get:function(){return this.vc}},padding:{configurable:!0,get:function(){return this.mb},set:function(a){"number"===
typeof a?(0>a&&ya(a,">= 0",V,"padding"),a=new lc(a)):(x(a,lc,V,"padding"),0>a.left&&ya(a.left,">= 0",V,"padding:value.left"),0>a.right&&ya(a.right,">= 0",V,"padding:value.right"),0>a.top&&ya(a.top,">= 0",V,"padding:value.top"),0>a.bottom&&ya(a.bottom,">= 0",V,"padding:value.bottom"));var b=this.mb;b.A(a)||(this.mb=a=a.J(),this.v(),this.g("padding",b,a))}},defaultAlignment:{configurable:!0,get:function(){return this.Yn},set:function(a){var b=this.Yn;b.A(a)||(F&&x(a,M,V,"defaultAlignment"),
this.Yn=a=a.J(),this.v(),this.g("defaultAlignment",b,a))}},defaultStretch:{configurable:!0,get:function(){return this.cg},set:function(a){var b=this.cg;b!==a&&(hb(a,N,V,"defaultStretch"),this.cg=a,this.v(),this.g("defaultStretch",b,a))}},defaultSeparatorPadding:{configurable:!0,get:function(){return void 0===this.Oj?Ec:this.Oj},set:function(a){if(void 0!==this.Oj){"number"===typeof a?a=new lc(a):F&&x(a,lc,V,"defaultSeparatorPadding");var b=this.Oj;b.A(a)||(this.Oj=a=a.J(),
this.v(),this.g("defaultSeparatorPadding",b,a))}}},defaultRowSeparatorStroke:{configurable:!0,get:function(){return void 0===this.Di?null:this.Di},set:function(a){var b=this.Di;b!==a&&(null===a||"string"===typeof a||a instanceof Hl)&&(a instanceof Hl&&a.freeze(),this.Di=a,this.P(),this.g("defaultRowSeparatorStroke",b,a))}},defaultRowSeparatorStrokeWidth:{configurable:!0,get:function(){return void 0===this.gh?1:this.gh},set:function(a){if(void 0!==this.gh){var b=this.gh;
b!==a&&isFinite(a)&&0<=a&&(this.gh=a,this.v(),this.g("defaultRowSeparatorStrokeWidth",b,a))}}},defaultRowSeparatorDashArray:{configurable:!0,get:function(){return void 0===this.Ci?null:this.Ci},set:function(a){if(void 0!==this.Ci){var b=this.Ci;if(b!==a){null===a||Array.isArray(a)||xa(a,"Array",V,"defaultRowSeparatorDashArray:value");if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||v("defaultRowSeparatorDashArray value "+f+" at index "+
e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.Ci=a;this.P();this.g("defaultRowSeparatorDashArray",b,a)}}}},defaultColumnSeparatorStroke:{configurable:!0,get:function(){return void 0===this.eh?null:this.eh},set:function(a){if(void 0!==this.eh){var b=this.eh;b!==a&&(null===a||"string"===typeof a||a instanceof Hl)&&(a instanceof Hl&&a.freeze(),this.eh=a,this.P(),this.g("defaultColumnSeparatorStroke",b,a))}}},defaultColumnSeparatorStrokeWidth:{configurable:!0,
enumerable:!0,get:function(){return void 0===this.fh?1:this.fh},set:function(a){if(void 0!==this.fh){var b=this.fh;b!==a&&isFinite(a)&&0<=a&&(this.fh=a,this.v(),this.g("defaultColumnSeparatorStrokeWidth",b,a))}}},defaultColumnSeparatorDashArray:{configurable:!0,get:function(){return void 0===this.Bi?null:this.Bi},set:function(a){if(void 0!==this.Bi){var b=this.Bi;if(b!==a){null===a||Array.isArray(a)||xa(a,"Array",V,"defaultColumnSeparatorDashArray:value");if(null!==a){for(var c=a.length,
d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||v("defaultColumnSeparatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.Bi=a;this.P();this.g("defaultColumnSeparatorDashArray",b,a)}}}},viewboxStretch:{configurable:!0,get:function(){return this.Aq},set:function(a){var b=this.Aq;b!==a&&(hb(a,N,V,"viewboxStretch"),this.Aq=a,this.v(),this.g("viewboxStretch",b,a))}},gridCellSize:{configurable:!0,
enumerable:!0,get:function(){return this.yo},set:function(a){var b=this.yo;if(!b.A(a)){x(a,Hb,V,"gridCellSize");a.o()&&0!==a.width&&0!==a.height||v("Invalid Panel.gridCellSize: "+a);this.yo=a.J();var c=this.diagram;null!==c&&this===c.grid&&Bj(c);this.P();this.g("gridCellSize",b,a)}}},gridOrigin:{configurable:!0,get:function(){return this.zo},set:function(a){var b=this.zo;if(!b.A(a)){x(a,J,V,"gridOrigin");a.o()||v("Invalid Panel.gridOrigin: "+a);this.zo=a.J();var c=this.diagram;null!==
c&&this===c.grid&&Bj(c);this.P();this.g("gridOrigin",b,a)}}},graduatedMin:{configurable:!0,get:function(){return this.vo},set:function(a){C(a,V,"graduatedMin");var b=this.vo;b!==a&&(this.vo=a,this.v(),this.g("graduatedMin",b,a),sl(this)&&(a=this.part,null!==a&&tl(this,a,"graduatedRange")))}},graduatedMax:{configurable:!0,get:function(){return this.uo},set:function(a){C(a,V,"graduatedMax");var b=this.uo;b!==a&&(this.uo=a,this.v(),this.g("graduatedMax",b,a),sl(this)&&(a=
this.part,null!==a&&tl(this,a,"graduatedRange")))}},graduatedRange:{configurable:!0,get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{configurable:!0,get:function(){return this.xo},set:function(a){C(a,V,"graduatedTickUnit");var b=this.xo;b!==a&&0<a&&(this.xo=a,this.v(),this.g("graduatedTickUnit",b,a))}},graduatedTickBase:{configurable:!0,get:function(){return this.wo},set:function(a){C(a,V,"graduatedTickBase");var b=this.wo;b!==
a&&(this.wo=a,this.v(),this.g("graduatedTickBase",b,a))}},Yh:{configurable:!0,get:function(){return 0!==(this.I&8388608)},set:function(a){0!==(this.I&8388608)!==a&&(this.I^=8388608)}},rowCount:{configurable:!0,get:function(){return void 0===this.zb?0:this.zb.length}},columnCount:{configurable:!0,get:function(){return void 0===this.vb?0:this.vb.length}},rowSizing:{configurable:!0,get:function(){return void 0===this.mk?mn:this.mk},set:function(a){if(void 0!==
this.mk){var b=this.mk;b!==a&&(F&&a!==mn&&a!==Um&&v("Panel.rowSizing must be RowColumnDefinition.ProportionalExtra or RowColumnDefinition.None, not: "+a),this.mk=a,this.v(),this.g("rowSizing",b,a))}}},columnSizing:{configurable:!0,get:function(){return void 0===this.Lj?mn:this.Lj},set:function(a){if(void 0!==this.Lj){var b=this.Lj;b!==a&&(F&&a!==mn&&a!==Um&&v("Panel.columnSizing must be RowColumnDefinition.ProportionalExtra or RowColumnDefinition.None, not: "+a),this.Lj=a,this.v(),this.g("columnSizing",
b,a))}}},topIndex:{configurable:!0,get:function(){return void 0===this.hj?0:this.hj},set:function(a){if(void 0!==this.hj){var b=this.hj;b!==a&&((!isFinite(a)||0>a)&&v("Panel.topIndex must be greater than zero and a real number, not: "+a),this.hj=a,this.v(),this.g("topIndex",b,a))}}},leftIndex:{configurable:!0,get:function(){return void 0===this.Qi?0:this.Qi},set:function(a){if(void 0!==this.Qi){var b=this.Qi;b!==a&&((!isFinite(a)||0>a)&&v("Panel.leftIndex must be greater than zero and a real number, not: "+
a),this.Qi=a,this.v(),this.g("leftIndex",b,a))}}},data:{configurable:!0,get:function(){return this.qb},set:function(a){var b=this.qb;if(b!==a){var c=this instanceof S&&!(this instanceof Te);c&&A(a,"object",V,"data");Lg(this);this.qb=a;var d=this.diagram;null!==d&&(c?(c=d.partManager,this instanceof R?(null!==b&&c.df.remove(b),null!==a&&c.df.add(a,this)):this instanceof S&&(null!==b&&c.ef.remove(b),null!==a&&c.ef.add(a,this))):(c=this.panel,null!==c&&null!==c.Xd&&(null!==b&&c.Xd.remove(b),
null!==a&&c.Xd.add(a,this))));this.g("data",b,a);null!==d&&d.undoManager.isUndoingRedoing||null!==a&&this.Ha()}}},itemIndex:{configurable:!0,get:function(){return this.Mo},set:function(a){var b=this.Mo;b!==a&&(this.Mo=a,this.g("itemIndex",b,a))}},itemArray:{configurable:!0,get:function(){return this.Mi},set:function(a){var b=this.Mi;if(b!==a||null!==a&&An(this,a)){F&&null!==a&&!Ga(a)&&v("Panel.itemArray must be an Array-like object or null, not: "+a);var c=this.diagram;
b!==a&&(null!==c&&null!==b&&Xj(c.partManager,this,c),this.Mi=a,null!==c&&null!==a&&Uj(c.partManager,this));this.g("itemArray",b,a);null!==c&&c.undoManager.isUndoingRedoing||this.ru()}}},itemTemplate:{configurable:!0,get:function(){return null===this.ze?null:this.ze.K("")},set:function(a){if(null===this.ze){if(null===a)return;this.ze=new Db}var b=this.ze.K("");b!==a&&(x(a,V,V,"itemTemplate"),(a instanceof S||a.isPanelMain)&&v("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+
a),this.ze.add("",a),this.g("itemTemplate",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.ru())}},itemTemplateMap:{configurable:!0,get:function(){return this.ze},set:function(a){var b=this.ze;if(b!==a){x(a,Db,V,"itemTemplateMap");for(var c=a.iterator;c.next();){var d=c.value;F&&(d instanceof S||d.isPanelMain)&&v("Template in Panel.itemTemplateMap must not be a Part or be Panel.isPanelMain: "+d)}this.ze=a;this.g("itemTemplateMap",b,a);a=this.diagram;null!==a&&a.undoManager.isUndoingRedoing||
this.ru()}}},itemCategoryProperty:{configurable:!0,get:function(){return this.Ql},set:function(a){var b=this.Ql;b!==a&&("string"!==typeof a&&"function"!==typeof a&&xa(a,"string or function",V,"itemCategoryProperty"),this.Ql=a,this.g("itemCategoryProperty",b,a))}},isAtomic:{configurable:!0,get:function(){return 0!==(this.I&1048576)},set:function(a){var b=0!==(this.I&1048576);b!==a&&(A(a,"boolean",V,"isAtomic"),this.I^=1048576,this.g("isAtomic",b,a))}},isClipping:{configurable:!0,
enumerable:!0,get:function(){return 0!==(this.I&2097152)},set:function(a){var b=0!==(this.I&2097152);b!==a&&(A(a,"boolean",V,"isClipping"),a&&this.type!==V.Spot&&Ca("Warning: Panel.isClipping set on non-Spot Panel: "+this.toString()),this.I^=2097152,this.v(),this.g("isClipping",b,a))}},isOpposite:{configurable:!0,get:function(){return 0!==(this.I&33554432)},set:function(a){var b=0!==(this.I&33554432);b!==a&&(A(a,"boolean",V,"isOpposite"),this.I^=33554432,this.v(),this.g("isOpposite",
b,a))}},isEnabled:{configurable:!0,get:function(){return 0!==(this.I&4194304)},set:function(a){var b=0!==(this.I&4194304);if(b!==a){A(a,"boolean",V,"isEnabled");var c=null===this.panel||this.panel.Tg();this.I^=4194304;this.g("isEnabled",b,a);b=this.diagram;null!==b&&b.undoManager.isUndoingRedoing||c&&wn(this,this,a)}}},alignmentFocusName:{configurable:!0,get:function(){return this.Xg},set:function(a){var b=this.Xg;b!==a&&(F&&A(a,"string",V,"alignmentFocusName"),this.Xg=
a,this.v(),this.g("alignmentFocusName",b,a))}}});
ma.Object.defineProperties(V,{Position:{configurable:!0,get:function(){return am.K("Position")}},Horizontal:{configurable:!0,get:function(){return am.K("Horizontal")}},Vertical:{configurable:!0,get:function(){return am.K("Vertical")}},Spot:{configurable:!0,get:function(){return am.K("Spot")}},Auto:{configurable:!0,get:function(){return am.K("Auto")}},Table:{configurable:!0,get:function(){return am.K("Table")}},Viewbox:{configurable:!0,
enumerable:!0,get:function(){return am.K("Viewbox")}},TableRow:{configurable:!0,get:function(){return am.K("TableRow")}},TableColumn:{configurable:!0,get:function(){return am.K("TableColumn")}},Link:{configurable:!0,get:function(){return am.K("Link")}},Grid:{configurable:!0,get:function(){return am.K("Grid")}},Graduated:{configurable:!0,get:function(){return am.K("Graduated")}}});V.prototype.findItemPanelForData=V.prototype.Dy;
V.prototype.rebuildItemElements=V.prototype.ru;V.prototype.updateTargetBindings=V.prototype.Ha;V.prototype.copyTemplate=V.prototype.Sz;V.prototype.graduatedValueForPoint=V.prototype.GA;V.prototype.graduatedPointForValue=V.prototype.FA;V.prototype.findColumnForLocalX=V.prototype.hA;V.prototype.findRowForLocalY=V.prototype.pA;V.prototype.removeColumnDefinition=V.prototype.Fw;V.prototype.removeRowDefinition=V.prototype.Hw;V.prototype.removeAt=V.prototype.ib;V.prototype.remove=V.prototype.remove;
V.prototype.insertAt=V.prototype.Ab;V.prototype.elt=V.prototype.O;V.prototype.add=V.prototype.add;V.prototype.findObject=V.prototype.gb;V.prototype.findInVisualTree=V.prototype.Gm;V.prototype.walkVisualTreeFrom=V.prototype.Yk;V.prototype.findMainElement=V.prototype.ub;var zn=!1,Dn=!1,En=null,am=new Db;V.className="Panel";V.definePanelLayout=Hn;Hn("Position",new Km);Hn("Vertical",new Nm);Hn("Auto",new Pm);Hn("Link",new $m);
function gk(){fb(this);this.Ag=null;this.Cs=!0;this.Va=0;this.cd=NaN;this.yh=0;this.wh=Infinity;this.Db=ld;this.ra=this.na=0;this.kb=null;this.jq=In;this.Le=il;this.cq=this.Eg=null;this.eq=NaN;this.pb=this.pk=null;this.Un=!1}
gk.prototype.copy=function(){var a=new gk;a.Cs=this.Cs;a.Va=this.Va;a.cd=this.cd;a.yh=this.yh;a.wh=this.wh;a.Db=this.Db;a.na=this.na;a.ra=this.ra;a.Le=this.Le;a.jq=this.jq;null===this.Eg?a.Eg=null:a.Eg=this.Eg.J();a.cq=this.cq;a.eq=this.eq;a.pk=null;null!==this.pk&&(a.separatorDashArray=Ia(this.separatorDashArray));a.pb=this.pb;a.Un=this.Un;a.kb=this.kb;return a};t=gk.prototype;
t.Qt=function(a){x(a,gk,gk,"copyFrom:pd");a.isRow?this.height=a.height:this.width=a.width;this.minimum=a.minimum;this.maximum=a.maximum;this.alignment=a.alignment;this.stretch=a.stretch;this.sizing=a.sizing;this.Eg=null===a.separatorPadding?null:a.separatorPadding.J();this.separatorStroke=a.separatorStroke;this.separatorStrokeWidth=a.separatorStrokeWidth;this.pk=null;a.separatorDashArray&&(this.pk=Ia(a.separatorDashArray));this.background=a.background;this.coversSeparators=a.coversSeparators;this.kb=
a.kb};t.nb=function(a){a.classType===gk?this.sizing=a:Ba(this,a)};t.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+pb(this)};t.Dj=function(a){this.Ag=a};
t.Vv=function(){var a=0,b=0,c=this.Ag,d=this.isRow;if(null!==c&&c.type===V.Table)for(var e=d?c.zb.length:c.vb.length,f=0;f<e;f++){var g=d?c.zb[f]:c.vb[f];if(void 0!==g){b=g.index;break}}this.index!==b&&(b=this.separatorStroke,null===b&&null!==c&&(b=this.isRow?c.defaultRowSeparatorStroke:c.defaultColumnSeparatorStroke),null!==b&&(a=this.separatorStrokeWidth,isNaN(a)&&(null!==c?a=this.isRow?c.defaultRowSeparatorStrokeWidth:c.defaultColumnSeparatorStrokeWidth:a=0)));b=this.Eg;if(null===b)if(null!==c)b=
c.defaultSeparatorPadding;else return a;return a+(this.isRow?b.top:b.left)};
t.Bc=function(){var a=0,b=this.Ag,c=0,d=this.isRow;if(null!==b&&b.type===V.Table)for(var e=d?b.zb.length:b.vb.length,f=0;f<e;f++){var g=d?b.zb[f]:b.vb[f];if(void 0!==g){c=g.index;break}}this.index!==c&&(c=this.separatorStroke,null===c&&null!==b&&(c=d?b.defaultRowSeparatorStroke:b.defaultColumnSeparatorStroke),null!==c&&(a=this.separatorStrokeWidth,isNaN(a)&&(null!==b?a=d?b.defaultRowSeparatorStrokeWidth:b.defaultColumnSeparatorStrokeWidth:a=0)));d=this.Eg;if(null===d)if(null!==b)d=b.defaultSeparatorPadding;
else return a;return a+(this.isRow?d.top+d.bottom:d.left+d.right)};t.Gb=function(a,b,c){var d=this.Ag;if(null!==d&&(d.hb(He,a,this,b,c,void 0,void 0),null!==this.kb&&(b=d.diagram,null!==b&&!b.skipsModelSourceBindings&&(d=d.tj(),null!==d&&(b=d.data,null!==b)))))for(c=this.kb.iterator;c.next();)c.value.Ar(this,b,a,d)};function Tm(a){if(a.sizing===In){var b=a.Ag;return a.isRow?b.rowSizing:b.columnSizing}return a.sizing}
t.bind=function(a){a.pd=this;var b=this.panel;if(null!==b){var c=b.tj();null!==c&&Wl(c)&&v("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+a+" on "+b)}null===this.kb&&(this.kb=new H);this.kb.add(a)};
ma.Object.defineProperties(gk.prototype,{panel:{configurable:!0,get:function(){return this.Ag}},isRow:{configurable:!0,get:function(){return this.Cs},set:function(a){this.Cs=a}},index:{configurable:!0,get:function(){return this.Va},set:function(a){this.Va=a}},height:{configurable:!0,get:function(){return this.cd},set:function(a){var b=this.cd;b!==a&&(F&&A(a,"number",gk,"height"),0>a&&ya(a,">= 0",gk,"height"),this.cd=a,this.actual=this.na,null!==
this.panel&&this.panel.v(),this.Gb("height",b,a))}},width:{configurable:!0,get:function(){return this.cd},set:function(a){var b=this.cd;b!==a&&(F&&A(a,"number",gk,"width"),0>a&&ya(a,">= 0",gk,"width"),this.cd=a,this.actual=this.na,null!==this.panel&&this.panel.v(),this.Gb("width",b,a))}},minimum:{configurable:!0,get:function(){return this.yh},set:function(a){var b=this.yh;b!==a&&(F&&A(a,"number",gk,"minimum"),(0>a||!isFinite(a))&&ya(a,">= 0",gk,"minimum"),this.yh=a,this.actual=
this.na,null!==this.panel&&this.panel.v(),this.Gb("minimum",b,a))}},maximum:{configurable:!0,get:function(){return this.wh},set:function(a){var b=this.wh;b!==a&&(F&&A(a,"number",gk,"maximum"),0>a&&ya(a,">= 0",gk,"maximum"),this.wh=a,this.actual=this.na,null!==this.panel&&this.panel.v(),this.Gb("maximum",b,a))}},alignment:{configurable:!0,get:function(){return this.Db},set:function(a){var b=this.Db;b.A(a)||(F&&x(a,M,gk,"alignment"),this.Db=a.J(),null!==this.panel&&this.panel.v(),
this.Gb("alignment",b,a))}},stretch:{configurable:!0,get:function(){return this.Le},set:function(a){var b=this.Le;b!==a&&(F&&hb(a,N,gk,"stretch"),this.Le=a,null!==this.panel&&this.panel.v(),this.Gb("stretch",b,a))}},separatorPadding:{configurable:!0,get:function(){return this.Eg},set:function(a){"number"===typeof a?a=new lc(a):null!==a&&F&&x(a,lc,gk,"separatorPadding");var b=this.Eg;null!==a&&null!==b&&b.A(a)||(null!==a&&(a=a.J()),this.Eg=a,null!==this.panel&&this.panel.v(),
this.Gb("separatorPadding",b,a))}},separatorStroke:{configurable:!0,get:function(){return this.cq},set:function(a){var b=this.cq;b!==a&&(null!==a&&em(a,"RowColumnDefinition.separatorStroke"),a instanceof Hl&&a.freeze(),this.cq=a,null!==this.panel&&this.panel.v(),this.Gb("separatorStroke",b,a))}},separatorStrokeWidth:{configurable:!0,get:function(){return this.eq},set:function(a){var b=this.eq;b!==a&&(this.eq=a,null!==this.panel&&this.panel.v(),this.Gb("separatorStrokeWidth",
b,a))}},separatorDashArray:{configurable:!0,get:function(){return this.pk},set:function(a){var b=this.pk;if(b!==a){null===a||Array.isArray(a)||xa(a,"Array",gk,"separatorDashArray:value");if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||v("separatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.pk=a;null!==this.panel&&this.panel.P();this.Gb("separatorDashArray",
b,a)}}},background:{configurable:!0,get:function(){return this.pb},set:function(a){var b=this.pb;b!==a&&(null!==a&&em(a,"RowColumnDefinition.background"),a instanceof Hl&&a.freeze(),this.pb=a,null!==this.panel&&this.panel.P(),this.Gb("background",b,a))}},coversSeparators:{configurable:!0,get:function(){return this.Un},set:function(a){var b=this.Un;b!==a&&(A(a,"boolean",gk,"coversSeparators"),this.Un=a,null!==this.panel&&this.panel.P(),this.Gb("coversSeparators",b,a))}},
sizing:{configurable:!0,get:function(){return this.jq},set:function(a){var b=this.jq;b!==a&&(F&&hb(a,gk,gk,"sizing"),this.jq=a,null!==this.panel&&this.panel.v(),this.Gb("sizing",b,a))}},actual:{configurable:!0,get:function(){return this.na},set:function(a){this.na=isNaN(this.cd)?Math.max(Math.min(this.wh,a),this.yh):Math.max(Math.min(this.wh,this.cd),this.yh)}},total:{configurable:!0,get:function(){return this.na+this.Bc()},set:function(a){this.na=isNaN(this.cd)?
Math.max(Math.min(this.wh,a),this.yh):Math.max(Math.min(this.wh,this.cd),this.yh);this.na=Math.max(0,this.na-this.Bc())}},position:{configurable:!0,get:function(){return this.ra},set:function(a){this.ra=a}}});gk.prototype.bind=gk.prototype.bind;gk.prototype.computeEffectiveSpacing=gk.prototype.Bc;gk.prototype.computeEffectiveSpacingTop=gk.prototype.Vv;var In=new E(gk,"Default",0),Um=new E(gk,"None",1),mn=new E(gk,"ProportionalExtra",2);gk.className="RowColumnDefinition";gk.Default=In;
gk.None=Um;gk.ProportionalExtra=mn;function Yf(){N.call(this);this.Fd=this.ua=null;this.lo="None";this.to=il;this.Nc=this.yl="black";this.Ih=1;this.rm="butt";this.sm="miter";this.qk=10;this.Gh=null;this.Hh=0;this.Bf=this.Af=ld;this.Dp=this.Cp=NaN;this.Eo=!1;this.Fp=null;this.Al=this.ym="None";this.Wd=1;this.Ud=0;this.Sd=1;this.Td=null}la(Yf,N);
Yf.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.ua=this.ua;a.lo=this.lo;a.to=this.to;a.Fd=this.Fd;a.yl=this.yl;a.Nc=this.Nc;a.Ih=this.Ih;a.rm=this.rm;a.sm=this.sm;a.qk=this.qk;null!==this.Gh&&(a.Gh=Ia(this.Gh));a.Hh=this.Hh;a.Af=this.Af.J();a.Bf=this.Bf.J();a.Cp=this.Cp;a.Dp=this.Dp;a.Eo=this.Eo;a.Fp=this.Fp;a.ym=this.ym;a.Al=this.Al;a.Wd=this.Wd;a.Ud=this.Ud;a.Sd=this.Sd;a.Td=this.Td};t=Yf.prototype;
t.nb=function(a){a===Mg||a===Og||a===ll||a===il?this.geometryStretch=a:N.prototype.nb.call(this,a)};t.toString=function(){return"Shape("+("None"!==this.figure?this.figure:"None"!==this.toArrow?this.toArrow:this.fromArrow)+")#"+pb(this)};
function Jn(a,b,c,d){var e=c.length;if(!(4>e)){var f=d.measuredBounds,g=Math.max(1,f.width);f=f.height;for(var h=c[0],k=c[1],l,m,n,p,r,q,u=0,w=La(),y=2;y<e;y+=2)l=c[y],m=c[y+1],n=l-h,h=m-k,0===n&&(n=.001),p=h/n,r=Math.atan2(h,n),q=Math.sqrt(n*n+h*h),w.push([n,r,p,q]),u+=q,h=l,k=m;h=c[0];k=c[1];n=d.measuredBounds.width;d instanceof Yf&&(n-=d.strokeWidth);1>n&&(n=1);e=c=n;l=g/2;m=0===l?!1:!0;y=0;q=w[y];n=q[0];r=q[1];p=q[2];q=q[3];for(var z=0;.1<=u;){0===z&&(m?(e=c,e-=l,u-=l,m=!1):e=c,0===e&&(e=1));
if(e>u){Oa(w);return}e>q?(z=e-q,e=q):z=0;var B=Math.sqrt(e*e/(1+p*p));0>n&&(B=-B);h+=B;k+=p*B;a.translate(h,k);a.rotate(r);a.translate(-(g/2),-(f/2));0===z&&d.pj(a,b);a.translate(g/2,f/2);a.rotate(-r);a.translate(-h,-k);u-=e;q-=e;if(0!==z){y++;if(y===w.length){Oa(w);return}q=w[y];n=q[0];r=q[1];p=q[2];q=q[3];e=z}}Oa(w)}}
t.pj=function(a,b){var c=this.Nc,d=this.yl;if(null!==c||null!==d){var e=this.actualBounds,f=this.naturalBounds;null!==d&&zi(this,a,d,!0,!1,f,e);var g=this.part,h=this.Ih;null===c||0!==h||null===g||!this.isPanelMain&&g.ub()!==this||(h=g.type===V.Link&&g instanceof Te&&"Selection"===g.category&&g.adornedObject instanceof Yf&&g.adornedPart.ub()===g.adornedObject?g.adornedObject.strokeWidth:0);null!==c&&0!==h&&(zi(this,a,c,!1,!1,f,e),a.lineWidth=h,a.lineJoin=this.sm,a.lineCap=this.rm,a.miterLimit=this.qk);
e=!1;g&&b.Te("drawShadows")&&(e=g.isShadowed);g=!0;null===c||null!==d&&"transparent"!==d||(g=!1);f=!1;var k=this.strokeDashArray;null!==k&&(f=!0,a.Tt(k,this.Hh));var l=this.ua;if(null!==l){if(l.type===Id)a.beginPath(),a.moveTo(l.startX,l.startY),a.lineTo(l.endX,l.endY),null!==d&&a.fe(d),0!==h&&null!==c&&a.Gj();else if(l.type===Md){var m=l.startX;k=l.startY;var n=l.endX,p=l.endY;l=Math.min(m,n);var r=Math.min(k,p);m=Math.abs(n-m);k=Math.abs(p-k);a.beginPath();a.rect(l,r,m,k);null!==d&&a.fe(d);if(null!==
c){g&&e&&Gl(a);if(0!==h){if(0===m||0===k)a.beginPath(),a.rect(l,r,Math.max(m,.1),Math.max(k,.1));a.Gj()}g&&e&&Fl(a)}}else if(l.type===Nd)m=l.startX,k=l.startY,n=l.endX,p=l.endY,l=Math.abs(n-m)/2,r=Math.abs(p-k)/2,m=Math.min(m,n)+l,k=Math.min(k,p)+r,a.beginPath(),a.moveTo(m,k-r),a.bezierCurveTo(m+K.Wg*l,k-r,m+l,k-K.Wg*r,m+l,k),a.bezierCurveTo(m+l,k+K.Wg*r,m+K.Wg*l,k+r,m,k+r),a.bezierCurveTo(m-K.Wg*l,k+r,m-l,k+K.Wg*r,m-l,k),a.bezierCurveTo(m-l,k-K.Wg*r,m-K.Wg*l,k-r,m,k-r),a.closePath(),null!==d&&a.fe(d),
0!==h&&null!==c&&(g&&e?(Gl(a),a.Gj(),Fl(a)):a.Gj());else if(l.type===Gd)for(k=l.figures,l=k.length,r=0;r<l;r++){m=k.j[r];a.beginPath();a.moveTo(m.startX,m.startY);n=m.segments.j;p=n.length;for(var q=null,u=0;u<p;u++){var w=n[u];switch(w.type){case ie:a.moveTo(w.endX,w.endY);break;case Kd:a.lineTo(w.endX,w.endY);break;case je:a.bezierCurveTo(w.point1X,w.point1Y,w.point2X,w.point2Y,w.endX,w.endY);break;case ke:a.quadraticCurveTo(w.point1X,w.point1Y,w.endX,w.endY);break;case le:if(w.radiusX===w.radiusY){var y=
Math.PI/180;a.arc(w.point1X,w.point1Y,w.radiusX,w.startAngle*y,(w.startAngle+w.sweepAngle)*y,0>w.sweepAngle,null!==q?q.endX:m.startX,null!==q?q.endY:m.startY)}else if(q=ne(w,m),y=q.length,0===y)a.lineTo(w.centerX,w.centerY);else for(var z=0;z<y;z++){var B=q[z];0===z&&a.lineTo(B[0],B[1]);a.bezierCurveTo(B[2],B[3],B[4],B[5],B[6],B[7])}break;case me:z=y=0;if(null!==q&&q.type===le){q=ne(q,m);B=q.length;if(0===B){a.lineTo(w.centerX,w.centerY);break}q=q[B-1]||null;null!==q&&(y=q[6],z=q[7])}else y=null!==
q?q.endX:m.startX,z=null!==q?q.endY:m.startY;q=oe(w,m,y,z);y=q.length;if(0===y){a.lineTo(w.centerX,w.centerY);break}for(z=0;z<y;z++)B=q[z],a.bezierCurveTo(B[2],B[3],B[4],B[5],B[6],B[7]);break;default:v("Segment not of valid type: "+w.type)}w.isClosed&&a.closePath();q=w}e?m.isShadowed?(!0===m.isFilled&&"transparent"!==d&&null!==d&&a.fe(d),0!==h&&null!==c&&(g&&Gl(a),a.Gj(),g&&Fl(a))):(g&&Gl(a),!0===m.isFilled&&"transparent"!==d&&null!==d&&a.fe(d),0!==h&&null!==c&&a.Gj(),g&&Fl(a)):(!0===m.isFilled&&
null!==d&&a.fe(d),0!==h&&null!==c&&a.Gj())}f&&a.Rt();if(null!==this.pathPattern){c=this.pathPattern;c.measure(Infinity,Infinity);d=c.measuredBounds;c.arrange(0,0,d.width,d.height);h=this.geometry;a.save();a.beginPath();d=La();if(h.type===Id)d.push(h.startX),d.push(h.startY),d.push(h.endX),d.push(h.endY),Jn(a,b,d,c);else if(h.type===Gd)for(h=h.figures.iterator;h.next();){e=h.value;d.length=0;d.push(e.startX);d.push(e.startY);g=e.startX;f=e.startY;k=g;l=f;r=e.segments.j;m=r.length;for(n=0;n<m;n++){p=
r[n];switch(p.type){case ie:Jn(a,b,d,c);d.length=0;d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;k=g;l=f;break;case Kd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case je:K.Pe(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case ke:K.jr(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case le:u=ne(p,e);w=u.length;if(0===w){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(q=0;q<w;q++)y=u[q],K.Pe(g,f,y[2],y[3],
y[4],y[5],y[6],y[7],.5,d),g=y[6],f=y[7];break;case me:u=oe(p,e,g,f);w=u.length;if(0===w){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(q=0;q<w;q++)y=u[q],K.Pe(g,f,y[2],y[3],y[4],y[5],y[6],y[7],.5,d),g=y[6],f=y[7];break;default:v("Segment not of valid type: "+p.type)}p.isClosed&&(d.push(k),d.push(l),Jn(a,b,d,c))}Jn(a,b,d,c)}else if(h.type===Md)d.push(h.startX),d.push(h.startY),d.push(h.endX),d.push(h.startY),d.push(h.endX),d.push(h.endY),d.push(h.startX),d.push(h.endY),d.push(h.startX),
d.push(h.startY),Jn(a,b,d,c);else if(h.type===Nd){f=new te;f.startX=h.endX;f.startY=(h.startY+h.endY)/2;g=new ue(le);g.startAngle=0;g.sweepAngle=360;g.centerX=(h.startX+h.endX)/2;g.centerY=(h.startY+h.endY)/2;g.radiusX=Math.abs(h.startX-h.endX)/2;g.radiusY=Math.abs(h.startY-h.endY)/2;f.add(g);h=ne(g,f);e=h.length;if(0===e)d.push(g.centerX),d.push(g.centerY);else for(g=f.startX,f=f.startY,k=0;k<e;k++)l=h[k],K.Pe(g,f,l[2],l[3],l[4],l[5],l[6],l[7],.5,d),g=l[6],f=l[7];Jn(a,b,d,c)}Oa(d);a.restore();a.zc(!1)}}}};
t.ma=function(a,b){void 0===b&&(b=new J);if(a instanceof M){a.Sb()&&v("getDocumentPoint Spot must be a real, specific Spot, not: "+a.toString());var c=this.naturalBounds,d=this.strokeWidth;b.h(a.x*(c.width+d)-d/2+c.x+a.offsetX,a.y*(c.height+d)-d/2+c.y+a.offsetY)}else b.set(a);this.Gd.ya(b);return b};
t.Km=function(a){void 0===a&&(a=new L);var b=this.naturalBounds,c=this.Gd;b=L.allocAt(b.x,b.y,b.width,b.height);var d=this.strokeWidth;b.Oc(d/2,d/2);d=J.allocAt(b.x,b.y).transform(c);a.h(d.x,d.y,0,0);d.h(b.right,b.y).transform(c);qc(a,d.x,d.y,0,0);d.h(b.right,b.bottom).transform(c);qc(a,d.x,d.y,0,0);d.h(b.x,b.bottom).transform(c);qc(a,d.x,d.y,0,0);L.free(b);J.free(d);return a};
t.Vh=function(a,b){var c=this.geometry;if(null===c||null===this.fill&&null===this.stroke)return!1;var d=c.bounds,e=this.strokeWidth/2;c.type!==Id||b||(e+=2);var f=L.alloc();f.assign(d);f.Oc(e+2,e+2);if(!f.fa(a))return L.free(f),!1;d=e+1E-4;if(c.type===Id){if(null===this.stroke)return!1;d=(c.endX-c.startX)*(a.x-c.startX)+(c.endY-c.startY)*(a.y-c.startY);if(0>(c.startX-c.endX)*(a.x-c.endX)+(c.startY-c.endY)*(a.y-c.endY)||0>d)return!1;L.free(f);return K.Tb(c.startX,c.startY,c.endX,c.endY,e,a.x,a.y)}if(c.type===
Md){b=c.startX;var g=c.startY,h=c.endX;c=c.endY;f.x=Math.min(b,h);f.y=Math.min(g,c);f.width=Math.abs(h-b);f.height=Math.abs(c-g);if(null===this.fill){f.Oc(-d,-d);if(f.fa(a))return L.free(f),!1;f.Oc(d,d)}null!==this.stroke&&f.Oc(e,e);a=f.fa(a);L.free(f);return a}if(c.type===Nd){g=c.startX;e=c.startY;h=c.endX;var k=c.endY;c=Math.min(g,h);b=Math.min(e,k);g=Math.abs(h-g)/2;e=Math.abs(k-e)/2;c=a.x-(c+g);b=a.y-(b+e);if(null===this.fill){g-=d;e-=d;if(0>=g||0>=e||1>=c*c/(g*g)+b*b/(e*e))return L.free(f),!1;
g+=d;e+=d}null!==this.stroke&&(g+=d,e+=d);L.free(f);return 0>=g||0>=e?!1:1>=c*c/(g*g)+b*b/(e*e)}if(c.type===Gd)return L.free(f),null===this.fill?re(c,a.x,a.y,e):pe(c,a,e,1<this.strokeWidth,b);v("Unknown Geometry type: "+c.type);return!1};
t.Rm=function(a,b,c,d){var e=this.desiredSize,f=this.Ih;a=Math.max(a,0);b=Math.max(b,0);if(null!==this.Fd)var g=this.geometry.bounds;else{var h=this.figure,k=Kn[h];if(void 0===k){var l=K.me[h];"string"===typeof l&&(l=K.me[l]);"function"===typeof l?(k=l(null,100,100),Kn[h]=k):v("Unsupported Figure: "+h)}g=k.bounds}h=g.width;k=g.height;l=g.width;var m=g.height;switch(yl(this,!0)){case Mg:d=c=0;break;case Hd:l=Math.max(a-f,0);m=Math.max(b-f,0);break;case jl:l=Math.max(a-f,0);d=0;break;case kl:c=0,m=
Math.max(b-f,0)}isFinite(e.width)&&(l=e.width);isFinite(e.height)&&(m=e.height);e=this.maxSize;g=this.minSize;c=Math.max(c-f,g.width);d=Math.max(d-f,g.height);l=Math.min(e.width,l);m=Math.min(e.height,m);l=isFinite(l)?Math.max(c,l):Math.max(h,c);m=isFinite(m)?Math.max(d,m):Math.max(k,d);c=Ng(this);switch(c){case Mg:break;case Hd:h=l;k=m;break;case Og:c=Math.min(l/h,m/k);isFinite(c)||(c=1);h*=c;k*=c;break;default:v(c+" is not a valid geometryStretch.")}null!==this.Fd?(h=Math.max(h,.01),k=Math.max(k,
.01),c=null!==this.Fd?this.Fd:this.ua,e=c.bounds,d=h/e.width,e=k/e.height,isFinite(d)||(d=1),isFinite(e)||(e=1),c=1===d&&1===e?c:c.copy().scale(d,e),F&&c.freeze(),this.ua=c):null!==this.ua&&K.ca(this.ua.Kl,a-f)&&K.ca(this.ua.Jl,b-f)||(this.ua=Yf.makeGeometry(this,h,k));g=this.ua.bounds;Infinity===a||Infinity===b?vl(this,g.x-f/2,g.y-f/2,0===a&&0===h?0:g.width+f,0===b&&0===k?0:g.height+f):vl(this,-(f/2),-(f/2),l+f,m+f)};
function Ng(a){var b=a.geometryStretch;return null!==a.Fd?b===il?Hd:b:b===il?Kn[a.figure].defaultStretch:b}t.Th=function(a,b,c,d){Al(this,a,b,c,d)};t.hd=function(a,b,c){return this.Hk(a.x,a.y,b.x,b.y,c)};
t.Hk=function(a,b,c,d,e){var f=this.transform,g=1/(f.m11*f.m22-f.m12*f.m21),h=f.m22*g,k=-f.m12*g,l=-f.m21*g,m=f.m11*g,n=g*(f.m21*f.dy-f.m22*f.dx),p=g*(f.m12*f.dx-f.m11*f.dy);f=a*h+b*l+n;g=a*k+b*m+p;h=c*h+d*l+n;k=c*k+d*m+p;n=this.Ih/2;l=this.ua;null===l&&(this.measure(Infinity,Infinity),l=this.ua);p=l.bounds;m=!1;if(l.type===Id)if(1.5>=this.strokeWidth)m=K.Ve(l.startX,l.startY,l.endX,l.endY,f,g,h,k,e);else{l.startX===l.endX?(d=n,m=0):(b=(l.endY-l.startY)/(l.endX-l.startX),m=n/Math.sqrt(1+b*b),d=m*
b);b=La();a=new J;K.Ve(l.startX+d,l.startY+m,l.endX+d,l.endY+m,f,g,h,k,a)&&b.push(a);a=new J;K.Ve(l.startX-d,l.startY-m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);a=new J;K.Ve(l.startX+d,l.startY+m,l.startX-d,l.startY-m,f,g,h,k,a)&&b.push(a);a=new J;K.Ve(l.endX+d,l.endY+m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);h=b.length;if(0===h)return Oa(b),!1;m=!0;k=Infinity;for(d=0;d<h;d++)a=b[d],c=(a.x-f)*(a.x-f)+(a.y-g)*(a.y-g),c<k&&(k=c,e.x=a.x,e.y=a.y);Oa(b)}else if(l.type===Md)m=K.hd(p.x-n,p.y-n,p.x+p.width+
n,p.y+p.height+n,f,g,h,k,e);else if(l.type===Nd){b=L.allocAt(p.x,p.y,p.width,p.height).Oc(n,n);a:if(0===b.width)m=K.Ve(b.x,b.y,b.x,b.y+b.height,f,g,h,k,e);else if(0===b.height)m=K.Ve(b.x,b.y,b.x+b.width,b.y,f,g,h,k,e);else{a=b.width/2;l=b.height/2;d=b.x+a;m=b.y+l;c=9999;f!==h&&(c=(g-k)/(f-h));if(9999>Math.abs(c)){k=g-m-c*(f-d);if(0>a*a*c*c+l*l-k*k){e.x=NaN;e.y=NaN;m=!1;break a}n=Math.sqrt(a*a*c*c+l*l-k*k);h=(-(a*a*c*k)+a*l*n)/(l*l+a*a*c*c)+d;a=(-(a*a*c*k)-a*l*n)/(l*l+a*a*c*c)+d;l=c*(h-d)+k+m;k=c*
(a-d)+k+m;Math.abs((f-h)*(f-h))+Math.abs((g-l)*(g-l))<Math.abs((f-a)*(f-a))+Math.abs((g-k)*(g-k))?(e.x=h,e.y=l):(e.x=a,e.y=k)}else{h=l*l;k=f-d;h-=h/(a*a)*k*k;if(0>h){e.x=NaN;e.y=NaN;m=!1;break a}k=Math.sqrt(h);h=m+k;k=m-k;Math.abs(h-g)<Math.abs(k-g)?(e.x=f,e.y=h):(e.x=f,e.y=k)}m=!0}L.free(b)}else if(l.type===Gd){p=J.alloc();var r=h-f;var q=k-g;var u=r*r+q*q;e.x=h;e.y=k;for(var w=0;w<l.figures.count;w++){var y=l.figures.j[w],z=y.segments;r=y.startX;q=y.startY;for(var B=r,D=q,G=0;G<z.count;G++){var O=
z.j[G],T=O.type;var P=O.endX;var ba=O.endY;var Y=!1;switch(T){case ie:B=P;D=ba;break;case Kd:Y=Ln(r,q,P,ba,f,g,h,k,p);break;case je:Y=K.Hq(r,q,O.point1X,O.point1Y,O.point2X,O.point2Y,P,ba,f,g,h,k,.6,p);break;case ke:Y=K.Hq(r,q,r+2/3*(O.point1X-r),q+2/3*(O.point1Y-q),P+2/3*(O.point1X-P),ba+2/3*(O.point1Y-ba),P,ba,f,g,h,k,.6,p);break;case le:case me:T=O.type===le?ne(O,y):oe(O,y,r,q);var oa=T.length;if(0===oa){Y=Ln(r,q,O.centerX,O.centerY,f,g,h,k,p);break}ba=null;for(P=0;P<oa;P++){ba=T[P];if(0===P&&
Ln(r,q,ba[0],ba[1],f,g,h,k,p)){var Ea=Mn(f,g,p,u,e);Ea<u&&(u=Ea,m=!0)}K.Hq(ba[0],ba[1],ba[2],ba[3],ba[4],ba[5],ba[6],ba[7],f,g,h,k,.6,p)&&(Ea=Mn(f,g,p,u,e),Ea<u&&(u=Ea,m=!0))}P=ba[6];ba=ba[7];break;default:v("Unknown Segment type: "+T)}r=P;q=ba;Y&&(Y=Mn(f,g,p,u,e),Y<u&&(u=Y,m=!0));O.isClosed&&(P=B,ba=D,Ln(r,q,P,ba,f,g,h,k,p)&&(O=Mn(f,g,p,u,e),O<u&&(u=O,m=!0)))}}f=c-a;g=d-b;h=Math.sqrt(f*f+g*g);0!==h&&(f/=h,g/=h);e.x-=f*n;e.y-=g*n;J.free(p)}else v("Unknown Geometry type: "+l.type);if(!m)return!1;this.transform.ya(e);
return!0};function Mn(a,b,c,d,e){a=c.x-a;b=c.y-b;b=a*a+b*b;return b<d?(e.x=c.x,e.y=c.y,b):d}function Ln(a,b,c,d,e,f,g,h,k){var l=!1,m=(e-g)*(b-d)-(f-h)*(a-c);if(0===m)return!1;k.x=((e*h-f*g)*(a-c)-(e-g)*(a*d-b*c))/m;k.y=((e*h-f*g)*(b-d)-(f-h)*(a*d-b*c))/m;(a>c?a-c:c-a)<(b>d?b-d:d-b)?(a=b<d?b:d,b=b<d?d:b,(k.y>a||K.ca(k.y,a))&&(k.y<b||K.ca(k.y,b))&&(l=!0)):(b=a<c?a:c,a=a<c?c:a,(k.x>b||K.ca(k.x,b))&&(k.x<a||K.ca(k.x,a))&&(l=!0));return l}
t.Uh=function(a,b){if(void 0===b)return a.Qe(this.actualBounds);var c=this.ua;null===c&&(this.measure(Infinity,Infinity),c=this.ua);c=c.bounds;var d=this.strokeWidth/2,e=!1,f=J.alloc();f.h(c.x-d,c.y-d);a.fa(b.ya(f))&&(f.h(c.x-d,c.bottom+d),a.fa(b.ya(f))&&(f.h(c.right+d,c.bottom+d),a.fa(b.ya(f))&&(f.h(c.right+d,c.y-d),a.fa(b.ya(f))&&(e=!0))));J.free(f);return e};
t.Rc=function(a,b){if(this.Uh(a,b)||void 0===b&&(b=this.transform,a.Qe(this.actualBounds)))return!0;var c=Ib.alloc();c.set(b);c.eu();var d=a.left,e=a.right,f=a.top;a=a.bottom;var g=J.alloc();g.h(d,f);c.ya(g);if(this.Vh(g,!0))return J.free(g),!0;g.h(e,f);c.ya(g);if(this.Vh(g,!0))return J.free(g),!0;g.h(d,a);c.ya(g);if(this.Vh(g,!0))return J.free(g),!0;g.h(e,a);c.ya(g);if(this.Vh(g,!0))return J.free(g),!0;var h=J.alloc(),k=J.alloc();c.set(b);c.ww(this.transform);c.eu();h.x=e;h.y=f;h.transform(c);g.x=
d;g.y=f;g.transform(c);b=!1;Xn(this,g,h,k)?b=!0:(g.x=e,g.y=a,g.transform(c),Xn(this,g,h,k)?b=!0:(h.x=d,h.y=a,h.transform(c),Xn(this,g,h,k)?b=!0:(g.x=d,g.y=f,g.transform(c),Xn(this,g,h,k)&&(b=!0))));J.free(g);Ib.free(c);J.free(h);J.free(k);return b};function Xn(a,b,c,d){if(!a.hd(b,c,d))return!1;a=b.x;b=b.y;var e=c.x,f=c.y;c=d.x;d=d.y;if(a===e)return b<f?(a=b,b=f):a=f,d>=a&&d<=b;a<e?(d=a,a=e):d=e;return c>=d&&c<=a}
t.Ey=function(a,b,c){function d(a,b){for(var c=a.length,d=0;d<c;d+=2)if(b.qd(a[d],a[d+1])>e)return!0;return!1}if(c&&null!==this.fill&&this.Vh(a,!0))return!0;var e=a.Se(b),f=e;1.5<this.strokeWidth&&(e=this.strokeWidth/2+Math.sqrt(e),e*=e);b=this.ua;if(null===b&&(this.measure(Infinity,Infinity),b=this.ua,null===b))return!1;if(!c){var g=b.bounds,h=g.x,k=g.y,l=g.x+g.width;g=g.y+g.height;if(Lb(a.x,a.y,h,k)<=e&&Lb(a.x,a.y,l,k)<=e&&Lb(a.x,a.y,h,g)<=e&&Lb(a.x,a.y,l,g)<=e)return!0}h=b.startX;k=b.startY;l=
b.endX;g=b.endY;if(b.type===Id){if(c=Kb(a.x,a.y,h,k,l,g),b=(h-l)*(a.x-l)+(k-g)*(a.y-g),c<=(0<=(l-h)*(a.x-h)+(g-k)*(a.y-k)&&0<=b?e:f))return!0}else{if(b.type===Md)return b=!1,c&&(b=Kb(a.x,a.y,h,k,h,g)<=e||Kb(a.x,a.y,h,k,l,k)<=e||Kb(a.x,a.y,l,k,l,g)<=e||Kb(a.x,a.y,h,g,l,g)<=e),b;if(b.type===Nd){b=a.x-(h+l)/2;f=a.y-(k+g)/2;var m=Math.abs(l-h)/2,n=Math.abs(g-k)/2;if(0===m||0===n)return Kb(a.x,a.y,h,k,l,g)<=e?!0:!1;if(c){if(a=K.Yz(m,n,b,f),a*a<=e)return!0}else return Lb(b,f,-m,0)>=e||Lb(b,f,0,-n)>=e||
Lb(b,f,0,n)>=e||Lb(b,f,m,0)>=e?!1:!0}else if(b.type===Gd){l=b.bounds;f=l.x;h=l.y;k=l.x+l.width;l=l.y+l.height;if(a.x>k&&a.x<f&&a.y>l&&a.y<h&&Kb(a.x,a.y,f,h,f,l)>e&&Kb(a.x,a.y,f,h,k,h)>e&&Kb(a.x,a.y,k,l,f,l)>e&&Kb(a.x,a.y,k,l,k,h)>e)return!1;f=Math.sqrt(e);if(c){if(null===this.fill?re(b,a.x,a.y,f):pe(b,a,f,!0,!1))return!0}else{c=b.figures;for(b=0;b<c.count;b++){f=c.j[b];g=f.startX;m=f.startY;if(a.qd(g,m)>e)return!1;h=f.segments.j;k=h.length;for(l=0;l<k;l++)switch(n=h[l],n.type){case ie:case Kd:g=n.endX;
m=n.endY;if(a.qd(g,m)>e)return!1;break;case je:var p=La();K.Pe(g,m,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.8,p);g=d(p,a);Oa(p);if(g)return!1;g=n.endX;m=n.endY;if(a.qd(g,m)>e)return!1;break;case ke:p=La();K.jr(g,m,n.point1X,n.point1Y,n.endX,n.endY,.8,p);g=d(p,a);Oa(p);if(g)return!1;g=n.endX;m=n.endY;if(a.qd(g,m)>e)return!1;break;case le:case me:p=n.type===le?ne(n,f):oe(n,f,g,m);var r=p.length;if(0===r){g=n.centerX;m=n.centerY;if(a.qd(g,m)>e)return!1;break}n=null;for(var q=La(),u=0;u<
r;u++)if(n=p[u],q.length=0,K.Pe(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.8,q),d(q,a))return Oa(q),!1;Oa(q);null!==n&&(g=n[6],m=n[7]);break;default:v("Unknown Segment type: "+n.type)}}return!0}}}return!1};t.ic=function(){this.ua=null};function Yn(a){var b=a.diagram;null!==b&&b.undoManager.isUndoingRedoing||(a.segmentOrientation=jn,"None"!==a.ym?(a.segmentIndex=-1,a.alignmentFocus=sd):"None"!==a.Al&&(a.segmentIndex=0,a.alignmentFocus=new M(1-sd.x,sd.y)))}
Yf.makeGeometry=function(a,b,c){if("None"!==a.toArrow)var d=Zn[a.toArrow];else"None"!==a.fromArrow?d=Zn[a.fromArrow]:(d=K.me[a.figure],"string"===typeof d&&(d=K.me[d]),void 0===d&&v("Unknown Shape.figure: "+a.figure),d=d(a,b,c),d.Kl=b,d.Jl=c);if(null===d){var e=K.me.Rectangle;"function"===typeof e&&(d=e(a,b,c))}F&&(d.bounds.width>b+1E-5||d.bounds.height>c+1E-5)&&v('Geometry made with figure "'+a.figure+'" has bounds '+d.bounds.toString()+" that are too large for the given size ("+b+","+c+"). See documentation for Shape.defineFigureGenerator.");
return d};function $n(a){var b=Zn[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=Zn[c];if(void 0===b){var d=null,e;for(e in K.pn)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=Od(K.pn[d],!1),Zn[d]=a,c!==d&&(Zn[c]=d),d}}return"string"===typeof b?b:b instanceof Fd?a:null}
ma.Object.defineProperties(Yf.prototype,{geometry:{configurable:!0,get:function(){return null!==this.ua?this.ua:this.Fd},set:function(a){var b=this.ua,c=this.Fd;if(b!==a){null!==a?(F&&x(a,Fd,Yf,"geometry"),this.Fd=this.ua=a.freeze()):this.Fd=this.ua=null;var d=this.part;null!==d&&(d.vh=NaN);this.v();this.g("geometry",b||c,a);sl(this)&&(a=this.part,null!==a&&tl(this,a,"geometryString"))}}},geometryString:{configurable:!0,get:function(){return null===this.geometry?"":this.geometry.toString()},
set:function(a){a=Od(a);var b=a.normalize();this.geometry=a;this.position=a=J.allocAt(-b.x,-b.y);J.free(a)}},isGeometryPositioned:{configurable:!0,get:function(){return this.Eo},set:function(a){F&&A(a,"boolean",Yf,"isGeometryPositioned");var b=this.Eo;b!==a&&(this.Eo=a,this.v(),this.g("isGeometryPositioned",b,a))}},fill:{configurable:!0,get:function(){return this.yl},set:function(a){var b=this.yl;b!==a&&(null!==a&&em(a,"Shape.fill"),a instanceof Hl&&a.freeze(),this.yl=
a,this.P(),this.g("fill",b,a))}},stroke:{configurable:!0,get:function(){return this.Nc},set:function(a){var b=this.Nc;b!==a&&(null!==a&&em(a,"Shape.stroke"),a instanceof Hl&&a.freeze(),this.Nc=a,this.P(),this.g("stroke",b,a))}},strokeWidth:{configurable:!0,get:function(){return this.Ih},set:function(a){var b=this.Ih;if(b!==a)if(F&&C(a,Yf,"strokeWidth"),0<=a){this.Ih=a;this.v();var c=this.part;null!==c&&(c.vh=NaN);this.g("strokeWidth",b,a)}else ya(a,"value >= 0",Yf,"strokeWidth:value")}},
strokeCap:{configurable:!0,get:function(){return this.rm},set:function(a){var b=this.rm;b!==a&&("string"!==typeof a||"butt"!==a&&"round"!==a&&"square"!==a?ya(a,'"butt", "round", or "square"',Yf,"strokeCap"):(this.rm=a,this.P(),this.g("strokeCap",b,a)))}},strokeJoin:{configurable:!0,get:function(){return this.sm},set:function(a){var b=this.sm;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?ya(a,'"miter", "bevel", or "round"',Yf,"strokeJoin"):(this.sm=
a,this.P(),this.g("strokeJoin",b,a)))}},strokeMiterLimit:{configurable:!0,get:function(){return this.qk},set:function(a){var b=this.qk;if(b!==a)if(F&&C(a,Yf,"strokeMiterLimit"),1<=a){this.qk=a;this.P();var c=this.part;null!==c&&(c.vh=NaN);this.g("strokeMiterLimit",b,a)}else F&&ya(a,"value >= 1",Yf,"strokeWidth:value")}},strokeDashArray:{configurable:!0,get:function(){return this.Gh},set:function(a){var b=this.Gh;if(b!==a){null===a||Array.isArray(a)||xa(a,"Array",Yf,"strokeDashArray:value");
if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];(!F||"number"===typeof f)&&0<=f&&isFinite(f)||v("strokeDashArray:value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.Gh=a;this.P();this.g("strokeDashArray",b,a)}}},strokeDashOffset:{configurable:!0,get:function(){return this.Hh},set:function(a){var b=this.Hh;b!==a&&(F&&C(a,Yf,"strokeDashOffset"),0<=a&&(this.Hh=a,this.P(),this.g("strokeDashOffset",b,a)))}},figure:{configurable:!0,
enumerable:!0,get:function(){return this.lo},set:function(a){var b=this.lo;if(b!==a){F&&A(a,"string",Yf,"figure");var c=K.me[a];"function"===typeof c?c=a:(c=K.me[a.toLowerCase()])||v("Unknown Shape.figure: "+a);b!==c&&(a=this.part,null!==a&&(a.vh=NaN),this.lo=c,this.Fd=null,this.ic(),this.v(),this.g("figure",b,c))}}},toArrow:{configurable:!0,get:function(){return this.ym},set:function(a){var b=this.ym;!0===a?a="Standard":!1===a&&(a="");if(b!==a){F&&A(a,"string",Yf,"toArrow");var c=$n(a);
null===c?v("Unknown Shape.toArrow: "+a):b!==c&&(this.ym=c,this.Fd=null,this.ic(),this.v(),Yn(this),this.g("toArrow",b,c))}}},fromArrow:{configurable:!0,get:function(){return this.Al},set:function(a){var b=this.Al;!0===a?a="Standard":!1===a&&(a="");if(b!==a){F&&A(a,"string",Yf,"fromArrow");var c=$n(a);null===c?v("Unknown Shape.fromArrow: "+a):b!==c&&(this.Al=c,this.Fd=null,this.ic(),this.v(),Yn(this),this.g("fromArrow",b,c))}}},spot1:{configurable:!0,get:function(){return this.Af},
set:function(a){x(a,M,Yf,"spot1");var b=this.Af;b.A(a)||(this.Af=a=a.J(),this.v(),this.g("spot1",b,a))}},spot2:{configurable:!0,get:function(){return this.Bf},set:function(a){x(a,M,Yf,"spot2");var b=this.Bf;b.A(a)||(this.Bf=a=a.J(),this.v(),this.g("spot2",b,a))}},parameter1:{configurable:!0,get:function(){return this.Cp},set:function(a){var b=this.Cp;b!==a&&(this.Cp=a,this.ic(),this.v(),this.g("parameter1",b,a))}},parameter2:{configurable:!0,get:function(){return this.Dp},
set:function(a){var b=this.Dp;b!==a&&(this.Dp=a,this.ic(),this.v(),this.g("parameter2",b,a))}},naturalBounds:{configurable:!0,get:function(){if(null!==this.ua)return this.vc.assign(this.ua.bounds),this.vc;var a=this.desiredSize;return new L(0,0,a.width,a.height)}},pathPattern:{configurable:!0,get:function(){return this.Fp},set:function(a){var b=this.Fp;b!==a&&(F&&null!==a&&x(a,N,Yf,"pathPattern"),this.Fp=a,this.P(),this.g("pathPattern",b,a))}},geometryStretch:{configurable:!0,
enumerable:!0,get:function(){return this.to},set:function(a){var b=this.to;b!==a&&(hb(a,N,Yf,"geometryStretch"),this.to=a,this.g("geometryStretch",b,a))}},interval:{configurable:!0,get:function(){return this.Wd},set:function(a){var b=this.Wd;F&&C(a,Yf,"interval");a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Wd=a;var c=this.diagram;null!==c&&this.panel===c.grid&&Bj(c);this.v();c=this.panel;null!==c&&(c.ph=null);this.g("interval",b,a)}}},graduatedStart:{configurable:!0,
get:function(){return this.Ud},set:function(a){var b=this.Ud;F&&C(a,Yf,"graduatedStart");b!==a&&(0>a?a=0:1<a&&(a=1),this.Ud=a,this.v(),this.g("graduatedStart",b,a))}},graduatedEnd:{configurable:!0,get:function(){return this.Sd},set:function(a){var b=this.Sd;F&&C(a,Yf,"graduatedEnd");b!==a&&(0>a?a=0:1<a&&(a=1),this.Sd=a,this.v(),this.g("graduatedEnd",b,a))}},graduatedSkip:{configurable:!0,get:function(){return this.Td},set:function(a){var b=this.Td;b!==a&&(null!==a&&A(a,
"function",Yf,"graduatedSkip"),this.Td=a,this.v(),this.g("graduatedSkip",b,a))}}});Yf.prototype.intersectsRect=Yf.prototype.Rc;Yf.prototype.containedInRect=Yf.prototype.Uh;Yf.prototype.getNearestIntersectionPoint=Yf.prototype.hd;Yf.prototype.getDocumentBounds=Yf.prototype.Km;Yf.prototype.getDocumentPoint=Yf.prototype.ma;var Zn=new jb,Kn=new jb;Yf.className="Shape";Yf.getFigureGenerators=function(){var a=new Db,b;for(b in K.me)b!==b.toLowerCase()&&a.add(b,K.me[b]);a.freeze();return a};
Yf.defineFigureGenerator=function(a,b){A(a,"string",Yf,"defineFigureGenerator:name");"string"===typeof b?!F||""!==b&&K.me[b]||v("Shape.defineFigureGenerator synonym must not be empty or None or not a defined figure name: "+b):A(b,"function",Yf,"defineFigureGenerator:func");var c=a.toLowerCase();!F||""!==a&&a!==c||v("Shape.defineFigureGenerator name must not be empty or all-lower-case: "+a);var d=K.me;d[a]=b;d[c]=a};
Yf.getArrowheadGeometries=function(){var a=new Db;for(d in K.pn)if(void 0===Zn[d]){var b=Od(K.pn[d],!1);Zn[d]=b;b=d.toLowerCase();b!==d&&(Zn[b]=d)}for(var c in Zn)if(c!==c.toLowerCase()){var d=Zn[c];d instanceof Fd&&a.add(c,d)}a.freeze();return a};
Yf.defineArrowheadGeometry=function(a,b){A(a,"string",Yf,"defineArrowheadGeometry:name");"string"===typeof b?(A(b,"string",Yf,"defineArrowheadGeometry:pathstr"),b=Od(b,!1)):x(b,Fd,Yf,"defineArrowheadGeometry:pathstr");var c=a.toLowerCase();(F&&""===a||"none"===c||a===c)&&v("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+a);var d=Zn;d[a]=b;d[c]=a};
function ih(){N.call(this);ao||(bo=gh?(new Qk(null)).context:null,ao=!0);this.Vx=this.Zb="";this.Nc="black";this.te="13px sans-serif";this.fj="start";this.Rd=Mg;this.lj=od;this.Yj=!0;this.Ki=this.Li=!1;this.yg=co;this.Lg=eo;this.Js=this.xb=this.ad=0;this.qv=this.rv=null;this.io=!1;this.Ic=this.Jn=this.tq=this.gj=this.uq=null;this.zf=this.yf=0;this.Ce=Infinity;this.Oi=0;this.ue=null;this.Ie=0;this.se=this.ob=this.Vb=null;this.Wd=1;this.Ud=0;this.Sd=1;this.Td=this.Uj=null}la(ih,N);
ih.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.Zb=this.Zb;a.Vx=this.Vx;a.Nc=this.Nc;a.te=this.te;a.fj=this.fj;a.Rd=this.Rd;a.lj=this.lj;a.Yj=this.Yj;a.Li=this.Li;a.Ki=this.Ki;a.yg=this.yg;a.Lg=this.Lg;a.ad=this.ad;a.Js=this.Js;a.xb=this.xb;a.rv=this.rv;a.qv=this.qv;a.io=this.io;a.uq=this.uq;a.gj=this.gj;a.tq=this.tq;a.Jn=this.Jn;a.Ic=this.Ic;a.yf=this.yf;a.zf=this.zf;a.Ce=this.Ce;a.ue=this.ue;a.Ie=this.Ie;a.Vb=this.Vb;a.ob=this.ob;a.se=this.se;a.Oi=this.Oi;a.Wd=
this.Wd;a.Ud=this.Ud;a.Sd=this.Sd;a.Uj=this.Uj;a.Td=this.Td};
function hn(a,b){a.I=b.I|6144;a.yb=b.opacity;a.pb=b.background;a.jc=b.areaBackground;a.$c=b.desiredSize.J();a.rg=b.minSize.J();a.qg=b.maxSize.J();a.og=b.og.copy();a.Fa=b.scale;a.dc=b.angle;a.Le=b.stretch;a.uh=b.margin.J();a.Db=b.alignment.J();a.el=b.alignmentFocus.J();a.hm=b.segmentFraction;a.im=b.segmentOffset.J();a.jm=b.segmentOrientation;null!==b.vd&&(a.vd=b.vd.copy());a.lm=b.shadowVisible;b instanceof ih&&(a.Zb=b.Zb,a.Nc=b.Nc,a.te=b.te,a.fj=b.fj,a.Rd=b.Rd,a.lj=b.lj,a.Yj=b.Yj,a.Li=b.Li,a.Ki=b.Ki,
a.yg=b.yg,a.Lg=b.Lg,a.ue=null,a.yf=b.yf,a.zf=b.zf,a.Ce=b.Ce,a.Oi=b.Oi,a.Wd=b.Wd,a.Ud=b.Ud,a.Sd=b.Sd,a.Uj=b.Uj,a.Td=b.Td)}t=ih.prototype;t.nb=function(a){a.classType===ih?this.wrap=a:N.prototype.nb.call(this,a)};t.toString=function(){return 22<this.Zb.length?'TextBlock("'+this.Zb.substring(0,20)+'"...)':'TextBlock("'+this.Zb+'")'};t.v=function(){N.prototype.v.call(this);this.qv=this.rv=null};
function fo(a){ao||(bo=gh?(new Qk(null)).context:null,ao=!0);if(null===bo)return!0;var b=bo.font;if(a===b||"10px sans-serif"===a)return!0;bo.font="10px sans-serif";bo.font=a;var c=bo.font;if("10px sans-serif"!==c)return bo.font=b,!0;bo.font="19px serif";var d=bo.font;bo.font=a;c=bo.font;bo.font=b;return c!==d}
t.pj=function(a,b){if(null!==this.Nc&&0!==this.Zb.length&&null!==this.te){var c=this.naturalBounds,d=this.actualBounds,e=c.width,f=c.height,g=go(this),h=a.textAlign=this.fj,k=b.Nl;"start"===h?h=k?"right":"left":"end"===h&&(h=k?"left":"right");k=this.Li;var l=this.Ki;zi(this,a,this.Nc,!0,!1,c,d);(k||l)&&zi(this,a,this.Nc,!1,!1,c,d);d=0;c=!1;var m=J.allocAt(0,0);this.Gd.ya(m);var n=J.allocAt(0,g);this.Gd.ya(n);var p=m.Se(n);J.free(m);J.free(n);m=b.scale;8>p*m*m&&(c=!0);b.Mb!==a&&(c=!1);!1===b.Te("textGreeking")&&
(c=!1);b=this.yf;p=this.zf;switch(this.flip){case nl:a.translate(e,0);a.scale(-1,1);break;case ml:a.translate(0,f);a.scale(1,-1);break;case ol:a.translate(e,f),a.scale(-1,-1)}m=this.ad;n=(b+g+p)*m;f>n&&(d=this.lj,d=d.y*f-d.y*n+d.offsetY);if(1===m&&null!==this.se)p=this.xb,p>e&&(p=e),this.oj(this.se,a,0,d+b,e,g,p,c,h,k,l);else if(null!==this.Vb&&null!==this.ob)for(n=0;n<m;n++){var r=this.Vb[n];r>e&&(r=e);d+=b;this.oj(this.ob[n],a,0,d,e,g,r,c,h,k,l);d+=g+p}switch(this.flip){case nl:a.scale(-1,1);a.translate(-e,
0);break;case ml:a.scale(1,-1);a.translate(0,-f);break;case ol:a.scale(-1,-1),a.translate(-e,-f)}}};
t.oj=function(a,b,c,d,e,f,g,h,k,l,m){var n=0;h?("left"===k?n=0:"right"===k?n=e-g:"center"===k&&(n=(e-g)/2),b.fillRect(c+n,d+.25*f,g,1)):("left"===k?n=0:"right"===k?n=e:"center"===k&&(n=e/2),e=null!==ho?ho(this,f):.75*f,b.fillText(a,c+n,d+e),a=f/20|0,0===a&&(a=1),"right"===k?n-=g:"center"===k&&(n-=g/2),l&&(k=null!==io?io(this,f):.8*f,b.beginPath(),b.lineWidth=a,b.moveTo(c+n,d+k),b.lineTo(c+n+g,d+k),b.stroke()),m&&(b.beginPath(),b.lineWidth=a,d=d+f-f/2.2|0,0!==a%2&&(d+=.5),b.moveTo(c+n,d),b.lineTo(c+
n+g,d),b.stroke()))};
t.Rm=function(a,b,c,d){this.Oi=a;var e=this.te;null!==bo&&jo!==e&&(jo=bo.font=e);this.xb=this.Ie=0;this.se=this.ob=this.Vb=this.ue=null;var f;if(isNaN(this.desiredSize.width)){e=this.Zb.replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(0===e.length)e=0;else if(this.isMultiline){for(var g=f=0,h=!1;!h;){var k=e.indexOf("\n",g);-1===k&&(k=e.length,h=!0);f=Math.max(f,ko(e.substr(g,k-g).trim()));g=k+1}e=f}else f=e.indexOf("\n",0),0<=f&&(e=e.substr(0,f)),e=ko(e);e=Math.min(e,a/this.scale);e=Math.max(8,e)}else e=
this.desiredSize.width;null!==this.panel&&(e=Math.min(e,this.panel.maxSize.width));f=lo(this,e);isNaN(this.desiredSize.height)?f=Math.min(f,b/this.scale):f=this.desiredSize.height;g=f;if(0!==this.xb&&null!==this.Vb&&null!==this.ob&&this.yg===mo&&(b=this.te,b=this.yg===mo?no(b):0,h=this.yf+this.zf,h=Math.max(0,go(this)+h),g=Math.min(this.maxLines-1,Math.max(Math.floor(g/h+.01)-1,0)),!(g+1>=this.ob.length))){h=this.ob[g];for(b=Math.max(1,a-b);ko(h)>b&&1<h.length;)h=h.substr(0,h.length-1);h+=oo;b=ko(h);
this.ob[g]=h;this.ob=this.ob.slice(0,g+1);this.Vb[g]=b;this.Vb=this.Vb.slice(0,g+1);this.Ie=this.ob.length;this.xb=Math.max(this.xb,b);this.ad=this.Ie;1===this.ad&&(this.se=this.ob[0])}if(this.wrap===po||isNaN(this.desiredSize.width))e=isNaN(a)?this.xb:Math.min(a,this.xb),isNaN(this.desiredSize.width)&&(e=Math.max(8,e));e=Math.max(c,e);f=Math.max(d,f);gc(this.vc,e,f);vl(this,0,0,e,f)};t.Th=function(a,b,c,d){Al(this,a,b,c,d)};
function qo(a,b,c){if(null===a.se)a.se=b,a.xb=c;else{if(null===a.ob||null===a.Vb)a.ob=[],a.Vb=[],a.ob.push(a.se),a.Vb.push(a.xb);a.ob.push(b);a.Vb.push(c)}}
function ro(a,b,c,d){b=b.trim();var e=0;var f=a.te;var g=a.yf+a.zf;g=Math.max(0,go(a)+g);var h=a.yg===mo?no(f):0;if(a.ad>=a.Ce)null!==d&&d.h(0,g);else{var k=b;if(a.Lg===so)if(a.Ie=1,f=ko(b),0===h||f<=c)a.xb=Math.max(a.xb,f),qo(a,b,a.xb),null!==d&&d.h(f,g);else{e=to(a,k);k=k.substr(e.length);b=to(a,k);for(f=ko(e+b);0<b.length&&f<=c;)e+=b,k=k.substr(b.length),b=to(a,k),f=ko((e+b).trim());e+=b.trim();for(c=Math.max(1,c-h);ko(e)>c&&1<e.length;)e=e.substr(0,e.length-1);e+=oo;b=ko(e);a.xb=b;qo(a,e,b);null!==
d&&d.h(b,g)}else{h=0;0===k.length&&(h=1,qo(a,k,0));for(;0<k.length;){var l=to(a,k);for(k=k.substr(l.length);ko(l)>c;){var m=1;f=ko(l.substr(0,m));for(b=0;f<=c;)m++,b=f,f=ko(l.substr(0,m));if(1===m){var n=f;e=Math.max(e,f)}else n=b,e=Math.max(e,b);m--;1>m&&(m=1);qo(a,l.substr(0,m),n);h++;l=l.substr(m);if(a.ad+h>a.Ce)break}b=to(a,k);for(f=ko(l+b);0<b.length&&f<=c;)l+=b,k=k.substr(b.length),b=to(a,k),f=ko((l+b).trim());l=l.trim();if(""!==l&&("\u00ad"===l[l.length-1]&&(l=l.substring(0,l.length-1)+"\u2010"),
0===b.length?(m=f,e=Math.max(e,f)):(m=b=ko(l),e=Math.max(e,b)),qo(a,l,m),h++,a.ad+h>a.Ce))break}a.Ie=Math.min(a.Ce,h);a.xb=Math.max(a.xb,e);null!==d&&d.h(a.xb,g*a.Ie)}}}function to(a,b){if(a.Lg===uo)return b.substr(0,1);a=b.length;for(var c=0,d=vo;c<a&&!d.test(b.charAt(c));)c++;for(;c<a&&d.test(b.charAt(c));)c++;return c>=a?b:b.substr(0,c)}function ko(a){return null===bo?8*a.length:bo.measureText(a).width}
function go(a){if(null!==a.ue)return a.ue;var b=a.te;if(null===bo){var c=16;return a.ue=c}void 0!==wo[b]&&5E3>xo?c=wo[b]:(c=1.3*bo.measureText("M").width,wo[b]=c,xo++);return a.ue=c}function no(a){if(null===bo)return 6;if(void 0!==yo[a]&&5E3>zo)var b=yo[a];else b=bo.measureText(oo).width,yo[a]=b,zo++;return b}
function lo(a,b){var c=a.Zb.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),d=a.yf+a.zf;d=Math.max(0,go(a)+d);if(0===c.length)return a.xb=0,a.ad=1,d;if(!a.isMultiline){var e=c.indexOf("\n",0);0<=e&&(c=c.substr(0,e))}e=0;for(var f=a.ad=0,g,h=!1;!h;){g=c.indexOf("\n",f);-1===g&&(g=c.length,h=!0);if(f<=g){f=c.substr(f,g-f);if(a.Lg!==so){a.Ie=0;var k=Hb.alloc();ro(a,f,b,k);e+=k.height;Hb.free(k);a.ad+=a.Ie}else ro(a,f,b,null),e+=d,a.ad++;a.ad===a.Ce&&(h=!0)}f=g+1}return a.Js=e}
ma.Object.defineProperties(ih.prototype,{font:{configurable:!0,get:function(){return this.te},set:function(a){var b=this.te;b!==a&&(F&&(A(a,"string",ih,"font"),fo(a)||v('Not a valid font: "'+a+'"')),this.te=a,this.ue=null,this.v(),this.g("font",b,a))}},text:{configurable:!0,get:function(){return this.Zb},set:function(a){var b=this.Zb;null!==a&&void 0!==a?a=a.toString():a="";b!==a&&(this.Zb=a,this.v(),this.g("text",b,a))}},textAlign:{configurable:!0,get:function(){return this.fj},
set:function(a){var b=this.fj;b!==a&&(F&&A(a,"string",ih,"textAlign"),"start"===a||"end"===a||"left"===a||"right"===a||"center"===a?(this.fj=a,this.P(),this.g("textAlign",b,a)):F&&ya(a,'"start", "end", "left", "right", or "center"',ih,"textAlign"))}},flip:{configurable:!0,get:function(){return this.Rd},set:function(a){var b=this.Rd;b!==a&&(hb(a,N,ih,"flip"),this.Rd=a,this.P(),this.g("flip",b,a))}},verticalAlignment:{configurable:!0,get:function(){return this.lj},set:function(a){var b=
this.lj;b.A(a)||(F&&(x(a,M,ih,"verticalAlignment"),a.Sb()&&v("TextBlock.verticalAlignment for "+this+" must be a real Spot, not:"+a)),this.lj=a=a.J(),Ql(this),this.g("verticalAlignment",b,a))}},naturalBounds:{configurable:!0,get:function(){if(!this.vc.o()){var a=Hb.alloc();ro(this,this.Zb,999999,a);var b=a.width;Hb.free(a);a=lo(this,b);var c=this.desiredSize;isNaN(c.width)||(b=c.width);isNaN(c.height)||(a=c.height);gc(this.vc,b,a)}return this.vc}},isMultiline:{configurable:!0,
get:function(){return this.Yj},set:function(a){var b=this.Yj;b!==a&&(F&&A(a,"boolean",ih,"isMultiline"),this.Yj=a,this.v(),this.g("isMultiline",b,a))}},isUnderline:{configurable:!0,get:function(){return this.Li},set:function(a){var b=this.Li;b!==a&&(F&&A(a,"boolean",ih,"isUnderline"),this.Li=a,this.P(),this.g("isUnderline",b,a))}},isStrikethrough:{configurable:!0,get:function(){return this.Ki},set:function(a){var b=this.Ki;b!==a&&(F&&A(a,"boolean",ih,"isStrikethrough"),
this.Ki=a,this.P(),this.g("isStrikethrough",b,a))}},wrap:{configurable:!0,get:function(){return this.Lg},set:function(a){var b=this.Lg;b!==a&&(F&&hb(a,ih,ih,"wrap"),this.Lg=a,this.v(),this.g("wrap",b,a))}},overflow:{configurable:!0,get:function(){return this.yg},set:function(a){var b=this.yg;b!==a&&(F&&hb(a,ih,ih,"overflow"),this.yg=a,this.v(),this.g("overflow",b,a))}},stroke:{configurable:!0,get:function(){return this.Nc},set:function(a){var b=this.Nc;b!==
a&&(null!==a&&em(a,"TextBlock.stroke"),a instanceof Hl&&a.freeze(),this.Nc=a,this.P(),this.g("stroke",b,a))}},lineCount:{configurable:!0,get:function(){return this.ad}},editable:{configurable:!0,get:function(){return this.io},set:function(a){var b=this.io;b!==a&&(F&&A(a,"boolean",ih,"editable"),this.io=a,this.g("editable",b,a))}},textEditor:{configurable:!0,get:function(){return this.uq},set:function(a){var b=this.uq;b!==a&&(!F||a instanceof bf||v("TextBlock.textEditor must be an HTMLInfo."),
this.uq=a,this.g("textEditor",b,a))}},errorFunction:{configurable:!0,get:function(){return this.Ic},set:function(a){var b=this.Ic;b!==a&&(null!==a&&A(a,"function",ih,"errorFunction"),this.Ic=a,this.g("errorFunction",b,a))}},interval:{configurable:!0,get:function(){return this.Wd},set:function(a){var b=this.Wd;F&&C(a,ih,"interval");a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Wd=a;this.v();var c=this.panel;null!==c&&(c.ph=null);this.g("interval",b,a)}}},graduatedStart:{configurable:!0,
enumerable:!0,get:function(){return this.Ud},set:function(a){var b=this.Ud;F&&C(a,ih,"graduatedStart");b!==a&&(0>a?a=0:1<a&&(a=1),this.Ud=a,this.v(),this.g("graduatedStart",b,a))}},graduatedEnd:{configurable:!0,get:function(){return this.Sd},set:function(a){var b=this.Sd;F&&C(a,ih,"graduatedEnd");b!==a&&(0>a?a=0:1<a&&(a=1),this.Sd=a,this.v(),this.g("graduatedEnd",b,a))}},graduatedFunction:{configurable:!0,get:function(){return this.Uj},set:function(a){var b=this.Uj;b!==
a&&(null!==a&&A(a,"function",ih,"graduatedFunction"),this.Uj=a,this.v(),this.g("graduatedFunction",b,a))}},graduatedSkip:{configurable:!0,get:function(){return this.Td},set:function(a){var b=this.Td;b!==a&&(null!==a&&A(a,"function",ih,"graduatedSkip"),this.Td=a,this.v(),this.g("graduatedSkip",b,a))}},textValidation:{configurable:!0,get:function(){return this.gj},set:function(a){var b=this.gj;b!==a&&(null!==a&&A(a,"function",ih,"textValidation"),this.gj=a,this.g("textValidation",
b,a))}},textEdited:{configurable:!0,get:function(){return this.tq},set:function(a){var b=this.tq;b!==a&&(null!==a&&A(a,"function",ih,"textEdited"),this.tq=a,this.g("textEdited",b,a))}},spacingAbove:{configurable:!0,get:function(){return this.yf},set:function(a){var b=this.yf;b!==a&&(F&&A(a,"number",ih,"spacingAbove"),this.yf=a,this.g("spacingAbove",b,a))}},spacingBelow:{configurable:!0,get:function(){return this.zf},set:function(a){var b=this.zf;b!==a&&(F&&
A(a,"number",ih,"spacingBelow"),this.zf=a,this.g("spacingBelow",b,a))}},maxLines:{configurable:!0,get:function(){return this.Ce},set:function(a){var b=this.Ce;b!==a&&(F&&A(a,"number",ih,"maxLines"),a=Math.floor(a),0>=a&&ya(a,"> 0",ih,"maxLines"),this.Ce=a,this.g("maxLines",b,a),this.v())}},metrics:{configurable:!0,get:function(){return{arrSize:null!==this.Vb?this.Vb:[this.xb],arrText:null!==this.ob?this.ob:[this.se],maxLineWidth:this.xb,fontHeight:this.ue}}},choices:{configurable:!0,
enumerable:!0,get:function(){return this.Jn},set:function(a){var b=this.Jn;b!==a&&(F&&null!==a&&!Array.isArray(a)&&xa(a,"Array",ih,"choices:value"),this.Jn=a,this.g("choices",b,a))}}});var ho=null,io=null,so=new E(ih,"None",0),po=new E(ih,"WrapFit",1),eo=new E(ih,"WrapDesiredSize",2),uo=new E(ih,"WrapBreakAll",3),co=new E(ih,"OverflowClip",0),mo=new E(ih,"OverflowEllipsis",1),vo=/[ \u200b\u00ad]/,wo=new jb,xo=0,yo=new jb,zo=0,oo="...",jo="",bo=null,ao=!1;ih.className="TextBlock";ih.getEllipsis=function(){return oo};
ih.setEllipsis=function(a){oo=a;yo=new jb;zo=0};ih.getBaseline=function(){return ho};ih.setBaseline=function(a){ho=a;a=Ua();for(var b=a.length,c=0;c<b;c++)a[c].We()};ih.getUnderline=function(){return io};ih.setUnderline=function(a){io=a;a=Ua();for(var b=a.length,c=0;c<b;c++)a[c].We()};ih.isValidFont=fo;ih.None=so;ih.WrapFit=po;ih.WrapDesiredSize=eo;ih.WrapBreakAll=uo;ih.OverflowClip=co;ih.OverflowEllipsis=mo;function Ao(){this.Vb=[];this.ob=[]}Ao.prototype.reset=function(){this.Vb=[];this.ob=[]};
Ao.prototype.Qt=function(a){this.Vb=Ia(a.Vb);this.ob=Ia(a.ob)};Ao.className="TextBlockMetrics";function mk(){N.call(this);this.kh=null;this.lq="";this.Fh=wc;this.Fl=Hd;this.Cf=this.Ic=null;this.El=Mc;this.Rd=Mg;this.um=null;this.ev=!1;this.zl=!0;this.Vl=!1;this.nm=null}la(mk,N);mk.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.element=this.kh;a.lq=this.lq;a.Fh=this.Fh.J();a.Fl=this.Fl;a.Rd=this.Rd;a.Ic=this.Ic;a.Cf=this.Cf;a.El=this.El.J();a.zl=this.zl;a.nm=this.nm};
t=mk.prototype;t.nb=function(a){a===Mg||a===Og||a===ll?this.imageStretch=a:N.prototype.nb.call(this,a)};t.toString=function(){return"Picture("+this.source+")#"+pb(this)};function ok(a){void 0===a&&(a="");A(a,"string",mk,"clearCache:url");""!==a?Bo[a]&&(delete Bo[a],Co--):(Bo=new jb,Co=0)}
function Do(a,b){a.As=!0;a.Bl=!1;for(var c,d=Ua(),e=d.length,f=0;f<e;f++){var g=d[f];c=a.getAttribute("src");var h=g.$i.K(c);if(null!==h)for(var k=h.length,l=0;l<k;l++)c=h[l],g.$s.add(c),g.Jb(),void 0===a.Bv&&(a.Bv=b,null!==c.Cf&&c.Cf(c,b))}}function Eo(a,b){a.Bl=b;for(var c,d=Ua(),e=d.length,f=0;f<e;f++){var g=d[f],h=a.getAttribute("src");c=g.$i.K(h);if(null!==c){g=c.length;h=La();for(var k=0;k<g;k++)h.push(c[k]);for(k=0;k<g;k++)c=h[k],null!==c.Ic&&c.Ic(c,b);Oa(h)}}}
t.fB=function(){if(""!==this.source){ok(this.source);var a=this.source;this.source="";this.source=a}};t.We=function(){this.P()};
t.pj=function(a,b){var c=this.kh;if(null!==c){var d=c.getAttribute("src");if(!(c instanceof HTMLImageElement&&(null===d||""===d)||c.Bl instanceof Event&&a instanceof Ll)){d=this.naturalBounds;var e=0,f=0,g=this.ev,h=g?+c.width:c.naturalWidth;g=g?+c.height:c.naturalHeight;void 0===h&&c.videoWidth&&(h=c.videoWidth);void 0===g&&c.videoHeight&&(g=c.videoHeight);h=h||d.width;g=g||d.height;if(0!==h&&0!==g){var k=h,l=g;this.sourceRect.o()&&(e=this.Fh.x,f=this.Fh.y,h=this.Fh.width,g=this.Fh.height);var m=
h,n=g,p=this.Fl,r=this.El;switch(p){case Mg:if(this.sourceRect.o())break;m>=d.width&&(e=e+r.offsetX+(m*r.x-d.width*r.x));n>=d.height&&(f=f+r.offsetY+(n*r.y-d.height*r.y));h=Math.min(d.width,m);g=Math.min(d.height,n);break;case Hd:m=d.width;n=d.height;break;case Og:case ll:p===Og?(p=Math.min(d.height/n,d.width/m),m*=p,n*=p):p===ll&&(p=Math.max(d.height/n,d.width/m),m*=p,n*=p,m>=d.width&&(e=(e+r.offsetX+(m*r.x-d.width*r.x)/m)*h),n>=d.height&&(f=(f+r.offsetY+(n*r.y-d.height*r.y)/n)*g),h*=1/(m/d.width),
g*=1/(n/d.height),m=d.width,n=d.height)}p=this.Mf()*b.scale;var q=m*p*n*p,u=h*g/q,w=c.__goCache;p=null;var y=Fo;if(c.As&&void 0!==w&&4<q&&u>y*y)for(null===w.nj&&(Go(w,4,k,l,c),Go(w,16,k,l,c)),k=w.nj,l=k.length,q=0;q<l;q++)if(k[q].ratio*k[q].ratio<u)p=k[q];else break;if(!b.wl){if(null===this.um)if(null===this.kh)this.um=!1;else{k=(new Qk(null)).context;k.drawImage(this.kh,0,0);try{k.getImageData(0,0,1,1).data[3]&&(this.um=!1),this.um=!1}catch(z){this.um=!0}}if(this.um)return}k=0;m<d.width&&(k=r.offsetX+
(d.width*r.x-m*r.x));l=0;n<d.height&&(l=r.offsetY+(d.height*r.y-n*r.y));switch(this.flip){case nl:a.translate(Math.min(d.width,m),0);a.scale(-1,1);break;case ml:a.translate(0,Math.min(d.height,n));a.scale(1,-1);break;case ol:a.translate(Math.min(d.width,m),Math.min(d.height,n)),a.scale(-1,-1)}if(b.Te("pictureRatioOptimization")&&!b.Ii&&void 0!==w&&null!==p&&1!==p.ratio){a.save();b=p.ratio;try{a.drawImage(p.source,e/b,f/b,Math.min(p.source.width,h/b),Math.min(p.source.height,g/b),k,l,Math.min(d.width,
m),Math.min(d.height,n))}catch(z){F&&this.zl&&Ca(z.toString()),this.zl=!1}a.restore()}else try{a.drawImage(c,e,f,h,g,k,l,Math.min(d.width,m),Math.min(d.height,n))}catch(z){F&&this.zl&&Ca(z.toString()),this.zl=!1}switch(this.flip){case nl:a.scale(-1,1);a.translate(-Math.min(d.width,m),0);break;case ml:a.scale(1,-1);a.translate(0,-Math.min(d.height,n));break;case ol:a.scale(-1,-1),a.translate(-Math.min(d.width,m),-Math.min(d.height,n))}}}}};
t.Rm=function(a,b,c,d){var e=this.desiredSize,f=yl(this,!0),g=this.kh,h=this.ev;if(h||!this.Vl&&g&&g.complete)this.Vl=!0;null===g&&(isFinite(e.width)||(a=0),isFinite(e.height)||(b=0));isFinite(e.width)||f===Hd||f===jl?(isFinite(a)||(a=this.sourceRect.o()?this.sourceRect.width:h?+g.width:g.naturalWidth),c=0):null!==g&&!1!==this.Vl&&(a=this.sourceRect.o()?this.sourceRect.width:h?+g.width:g.naturalWidth);isFinite(e.height)||f===Hd||f===kl?(isFinite(b)||(b=this.sourceRect.o()?this.sourceRect.height:h?
+g.height:g.naturalHeight),d=0):null!==g&&!1!==this.Vl&&(b=this.sourceRect.o()?this.sourceRect.height:h?+g.height:g.naturalHeight);isFinite(e.width)&&(a=e.width);isFinite(e.height)&&(b=e.height);e=this.maxSize;f=this.minSize;c=Math.max(c,f.width);d=Math.max(d,f.height);a=Math.min(e.width,a);b=Math.min(e.height,b);a=Math.max(c,a);b=Math.max(d,b);null===g||g.complete||(isFinite(a)||(a=0),isFinite(b)||(b=0));gc(this.vc,a,b);vl(this,0,0,a,b)};t.Th=function(a,b,c,d){Al(this,a,b,c,d)};
ma.Object.defineProperties(mk.prototype,{element:{configurable:!0,get:function(){return this.kh},set:function(a){var b=this.kh;if(b!==a){null===a||a instanceof HTMLImageElement||a instanceof HTMLVideoElement||a instanceof HTMLCanvasElement||v("Picture.element must be an instance of Image, Canvas, or Video, not: "+a);this.ev=a instanceof HTMLCanvasElement;this.kh=a;if(null!==a)if(a instanceof HTMLCanvasElement||!0===a.complete)a.Bl instanceof Event&&null!==this.Ic&&this.Ic(this,a.Bl),
!0===a.As&&null!==this.Cf&&this.Cf(this,a.Bv),a.As=!0,this.desiredSize.o()||(Aj(this,!1),this.v());else{var c=this;a.Kx||(a.addEventListener("load",function(b){Do(a,b);c.desiredSize.o()||(Aj(c,!1),c.v())}),a.addEventListener("error",function(b){Eo(a,b)}),a.Kx=!0)}this.g("element",b,a);this.P()}}},source:{configurable:!0,get:function(){return this.lq},set:function(a){var b=this.lq;if(b!==a){A(a,"string",mk,"source");this.lq=a;var c=Bo,d=this.diagram;if(gh){var e=null;if(void 0!==c[a])e=
c[a];else if(""!==a){30<Co&&(ok(),c=Bo);e=ua("img");var f=this;e.addEventListener("load",function(a){Do(e,a);f.desiredSize.o()||(Aj(f,!1),f.v())});e.addEventListener("error",function(a){Eo(e,a)});e.Kx=!0;var g=this.nm;null!==g&&(e.crossOrigin=g(this));e.src=a;c[a]=e;Co++}null!==d&&nk(d,this);this.element=e;null!==d&&null!==e&&lk(d,this);null!==e&&void 0===e.__goCache&&(e.__goCache=new Ho);this.v();this.P()}this.g("source",b,a)}}},sourceCrossOrigin:{configurable:!0,get:function(){return this.nm},
set:function(a){if(this.nm!==a&&(null!==a&&A(a,"function",mk,"sourceCrossOrigin"),this.nm=a,null!==this.element)){var b=this.element.getAttribute("src");null===a&&"string"===typeof b?this.element.crossOrigin=null:null!==a&&(this.element.crossOrigin=a(this));this.element.src=b}}},sourceRect:{configurable:!0,get:function(){return this.Fh},set:function(a){var b=this.Fh;b.A(a)||(x(a,L,mk,"sourceRect"),this.Fh=a=a.J(),this.P(),this.g("sourceRect",b,a))}},imageStretch:{configurable:!0,
get:function(){return this.Fl},set:function(a){var b=this.Fl;b!==a&&(hb(a,N,mk,"imageStretch"),this.Fl=a,this.P(),this.g("imageStretch",b,a))}},flip:{configurable:!0,get:function(){return this.Rd},set:function(a){var b=this.Rd;b!==a&&(hb(a,N,mk,"flip"),this.Rd=a,this.P(),this.g("flip",b,a))}},imageAlignment:{configurable:!0,get:function(){return this.El},set:function(a){x(a,M,mk,"imageAlignment");var b=this.El;b.A(a)||(this.El=a=a.J(),this.v(),this.g("imageAlignment",b,
a))}},errorFunction:{configurable:!0,get:function(){return this.Ic},set:function(a){var b=this.Ic;b!==a&&(null!==a&&A(a,"function",mk,"errorFunction"),this.Ic=a,this.g("errorFunction",b,a))}},successFunction:{configurable:!0,get:function(){return this.Cf},set:function(a){var b=this.Cf;b!==a&&(null!==a&&A(a,"function",mk,"successFunction"),this.Cf=a,this.g("successFunction",b,a))}},naturalBounds:{configurable:!0,get:function(){return this.vc}}});
mk.prototype.redraw=mk.prototype.We;mk.prototype.reloadSource=mk.prototype.fB;var Bo=null,Co=0,Fo=4;mk.className="Picture";Bo=new jb;mk.clearCache=ok;function Ho(){this.nj=null}function Go(a,b,c,d,e){null===a.nj&&(a.nj=[]);var f=new Qk(null),g=f.context,h=1/b;f.width=c/b;f.height=d/b;0!==f.width&&0!==f.height&&(b=new Io(f.La,b),c=1,0<a.nj.length&&(c=a.nj[a.nj.length-1],e=c.source,c=c.ratio),g.setTransform(h*c,0,0,h*c,0,0),g.drawImage(e,0,0),a.nj.push(b))}Ho.className="PictureCacheArray";
function Io(a,b){this.source=a;this.ratio=b}Io.className="PictureCacheInstance";function Jo(){this.Yt=new Fd;this.nc=null}t=Jo.prototype;t.reset=function(a){null!==a?(a.ka(),this.Yt=a,a.figures.clear()):this.Yt=new Fd;this.nc=null};function Xd(a,b,c,d,e){a.nc=new te;a.nc.startX=b;a.nc.startY=c;a.nc.isFilled=d;a.Yt.figures.add(a.nc);void 0!==e&&(a.nc.isShadowed=e)}function ae(a){var b=a.nc.segments.length;0<b&&a.nc.segments.O(b-1).close()}t.vr=function(a){this.nc.isShadowed=a};
t.moveTo=function(a,b,c){void 0===c&&(c=!1);var d=new ue(ie);d.endX=a;d.endY=b;c&&d.close();this.nc.segments.add(d)};t.lineTo=function(a,b,c){void 0===c&&(c=!1);var d=new ue(Kd);d.endX=a;d.endY=b;c&&d.close();this.nc.segments.add(d)};function Yd(a,b,c,d,e,f,g){var h;void 0===h&&(h=!1);var k=new ue(je);k.point1X=b;k.point1Y=c;k.point2X=d;k.point2Y=e;k.endX=f;k.endY=g;h&&k.close();a.nc.segments.add(k)}
function Zd(a,b,c,d,e){var f;void 0===f&&(f=!1);var g=new ue(ke);g.point1X=b;g.point1Y=c;g.endX=d;g.endY=e;f&&g.close();a.nc.segments.add(g)}t.arcTo=function(a,b,c,d,e,f,g){void 0===f&&(f=0);void 0===g&&(g=!1);var h=new ue(le);h.startAngle=a;h.sweepAngle=b;h.centerX=c;h.centerY=d;h.radiusX=e;h.radiusY=0!==f?f:e;g&&h.close();this.nc.segments.add(h)};function $d(a,b,c,d,e,f,g,h){var k;void 0===k&&(k=!1);b=new ue(me,g,h,b,c,d,e,f);k&&b.close();a.nc.segments.add(b)}
function Wd(a){var b=fe;if(null!==b)return fe=null,b.reset(a),b;b=new Jo;b.reset(a);return b}var fe=null;Jo.className="StreamGeometryContext";function Ko(a,b){var c=a.toLowerCase(),d=K.me;d[a]=b;d[c]=a}Ko("Rectangle",function(a,b,c){a="r"+b+","+c;var d=K.ei[a];if(void 0!==d)return d;d=new Fd(Md);d.endX=b;d.endY=c;50>K.fi&&(K.ei[a]=d,K.fi++);return d});
Ko("Square",function(a,b,c){a="s"+b+","+c;var d=K.ei[a];if(void 0!==d)return d;d=new Fd(Md);d.endX=b;d.endY=c;d.defaultStretch=Og;50>K.fi&&(K.ei[a]=d,K.fi++);return d});
Ko("RoundedRectangle",function(a,b,c){var d=a?a.parameter1:NaN;if(isNaN(d)||0>d)d=5;d=Math.min(d,b/3);d=Math.min(d,c/3);a=d*K.Wg;b=(new Fd).add((new te(d,0,!0)).add(new ue(Kd,b-d,0)).add(new ue(je,b,d,b-a,0,b,a)).add(new ue(Kd,b,c-d)).add(new ue(je,b-d,c,b,c-a,b-a,c)).add(new ue(Kd,d,c)).add(new ue(je,0,c-d,a,c,0,c-a)).add(new ue(Kd,0,d)).add((new ue(je,d,0,0,a,a,0)).close()));1<a&&(b.spot1=new M(0,0,a,a),b.spot2=new M(1,1,-a,-a));return b});Ko("Border","RoundedRectangle");
Ko("Ellipse",function(a,b,c){a="e"+b+","+c;var d=K.ei[a];if(void 0!==d)return d;d=new Fd(Nd);d.endX=b;d.endY=c;d.spot1=ud;d.spot2=vd;50>K.fi&&(K.ei[a]=d,K.fi++);return d});Ko("Circle",function(a,b,c){a="c"+b+","+c;var d=K.ei[a];if(void 0!==d)return d;d=new Fd(Nd);d.endX=b;d.endY=c;d.spot1=ud;d.spot2=vd;d.defaultStretch=Og;50>K.fi&&(K.ei[a]=d,K.fi++);return d});Ko("TriangleRight",function(a,b,c){return(new Fd).add((new te(0,0)).add(new ue(Kd,b,.5*c)).add((new ue(Kd,0,c)).close())).ln(0,.25,.5,.75)});
Ko("TriangleDown",function(a,b,c){return(new Fd).add((new te(0,0)).add(new ue(Kd,b,0)).add((new ue(Kd,.5*b,c)).close())).ln(.25,0,.75,.5)});Ko("TriangleLeft",function(a,b,c){return(new Fd).add((new te(b,c)).add(new ue(Kd,0,.5*c)).add((new ue(Kd,b,0)).close())).ln(.5,.25,1,.75)});Ko("TriangleUp",function(a,b,c){return(new Fd).add((new te(b,c)).add(new ue(Kd,0,c)).add((new ue(Kd,.5*b,0)).close())).ln(.25,.5,.75,1)});Ko("Triangle","TriangleUp");
Ko("Diamond",function(a,b,c){return(new Fd).add((new te(.5*b,0)).add(new ue(Kd,0,.5*c)).add(new ue(Kd,.5*b,c)).add((new ue(Kd,b,.5*c)).close())).ln(.25,.25,.75,.75)});Ko("LineH",function(a,b,c){a=new Fd(Id);a.startX=0;a.startY=c/2;a.endX=b;a.endY=c/2;return a});Ko("LineV",function(a,b,c){a=new Fd(Id);a.startX=b/2;a.startY=0;a.endX=b/2;a.endY=c;return a});Ko("None","Rectangle");Ko("BarH","Rectangle");Ko("BarV","Rectangle");Ko("MinusLine","LineH");
Ko("PlusLine",function(a,b,c){return(new Fd).add((new te(0,c/2,!1)).add(new ue(Kd,b,c/2)).add(new ue(ie,b/2,0)).add(new ue(Kd,b/2,c)))});Ko("XLine",function(a,b,c){return(new Fd).add((new te(0,c,!1)).add(new ue(Kd,b,0)).add(new ue(ie,0,0)).add(new ue(Kd,b,c)))});
K.pn={"":"",Standard:"F1 m 0,0 l 8,4 -8,4 2,-4 z",Backward:"F1 m 8,0 l -2,4 2,4 -8,-4 z",Triangle:"F1 m 0,0 l 8,4.62 -8,4.62 z",BackwardTriangle:"F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z",Boomerang:"F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z",BackwardBoomerang:"F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z",SidewaysV:"m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z",BackwardV:"m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z",OpenTriangle:"m 0,0 l 8,4 -8,4",BackwardOpenTriangle:"m 8,0 l -8,4 8,4",OpenTriangleLine:"m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8",
BackwardOpenTriangleLine:"m 8,0 l  -8,4 8,4 m -8.5,0 l 0,-8",OpenTriangleTop:"m 0,0 l 8,4 m 0,4",BackwardOpenTriangleTop:"m 8,0 l -8,4 m 0,4",OpenTriangleBottom:"m 0,8 l 8,-4",BackwardOpenTriangleBottom:"m 0,4 l 8,4",HalfTriangleTop:"F1 m 0,0 l 0,4 8,0 z m 0,8",BackwardHalfTriangleTop:"F1 m 8,0 l 0,4 -8,0 z m 0,8",HalfTriangleBottom:"F1 m 0,4 l 0,4 8,-4 z",BackwardHalfTriangleBottom:"F1 m 8,4 l 0,4 -8,-4 z",ForwardSemiCircle:"m 4,0 b 270 180 0 4 4",BackwardSemiCircle:"m 4,8 b 90 180 0 -4 4",Feather:"m 0,0 l 3,4 -3,4",
BackwardFeather:"m 3,0 l -3,4 3,4",DoubleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardDoubleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4",TripleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardTripleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4",ForwardSlash:"m 0,8 l 5,-8",BackSlash:"m 0,0 l 5,8",DoubleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8",DoubleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8",TripleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8",
TripleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8",Fork:"m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4",LineFork:"m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardLineFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8",CircleFork:"F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3",CircleLineFork:"F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",
BackwardCircleLineFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3",Circle:"F1 m 8,4 b 0 360 -4 0 4 z",Block:"F1 m 0,0 l 0,8 8,0 0,-8 z",StretchedDiamond:"F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z",Diamond:"F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z",Chevron:"F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z",StretchedChevron:"F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z",NormalArrow:"F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z",X:"m 0,0 l 8,8 m 0,-8 l -8,8",TailedNormalArrow:"F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z",
DoubleTriangle:"F1 m 0,0 l 4,4 -4,4 0,-8 z  m 4,0 l 4,4 -4,4 0,-8 z",BigEndArrow:"F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z",ConcaveTailArrow:"F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z",RoundedTriangle:"F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z",SimpleArrow:"F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z",AccelerationArrow:"F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z",BoxArrow:"F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z",
TriangleLine:"F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8",CircleEndedArrow:"F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z",DynamicWidthArrow:"F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z",EquilibriumArrow:"m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3",FastForward:"F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z",Kite:"F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z",HalfArrowTop:"F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8",HalfArrowBottom:"F1 m 0,8 l 4,-4 4,0 -8,4 z",
OpposingDirectionDoubleArrow:"F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z",PartialDoubleTriangle:"F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z",LineCircle:"F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z",DoubleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",TripleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",CircleLine:"F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8",DiamondCircle:"F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z",PlusCircle:"F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8",
OpenRightTriangleTop:"m 8,0 l 0,4 -8,0 m 0,4",OpenRightTriangleBottom:"m 8,8 l 0,-4 -8,0",Line:"m 0,0 l 0,8",DoubleLine:"m 0,0 l 0,8 m 2,0 l 0,-8",TripleLine:"m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8",PentagonArrow:"F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z"};
function S(a){V.call(this,a);this.F=2408959;this.th=this.Yf="";this.Pp=this.Lp=this.$p=this.Qo=null;this.bq="";this.Wf=this.Co=this.aq=this.Eh=null;this.Np="";this.Mp=cc;this.Zb=this.Qp="";this.Pi=this.Mn=this.yi=null;this.pg=(new J(NaN,NaN)).freeze();this.Xo="";this.pf=null;this.Yo=Hc;this.Rp=ld;this.hp=Sb;this.Zo=Tb;this.eo=null;this.Ro=127;this.gq=Ub;this.fq="gray";this.wf=4;this.Mx=-1;this.Eq=NaN;this.rz=new L;this.fk=null;this.vh=NaN}la(S,V);
S.prototype.cloneProtected=function(a){V.prototype.cloneProtected.call(this,a);a.F=this.F&-4097|49152;a.Yf=this.Yf;a.th=this.th;a.Qo=this.Qo;a.$p=this.$p;a.Lp=this.Lp;a.Pp=this.Pp;a.bq=this.bq;a.aq=this.aq;a.Co=this.Co;a.Wf=null;a.Np=this.Np;a.Mp=this.Mp.J();a.Qp=this.Qp;a.Rp=this.Rp.J();a.Zb=this.Zb;a.Mn=this.Mn;a.pg.assign(this.pg);a.Xo=this.Xo;a.Yo=this.Yo.J();a.hp=this.hp.J();a.Zo=this.Zo.J();a.eo=this.eo;a.Ro=this.Ro;a.gq=this.gq.J();a.fq=this.fq;a.wf=this.wf;a.Eq=this.Eq};
S.prototype.Kf=function(a){V.prototype.Kf.call(this,a);a.Zh();a.Eh=null;a.pf=null;a.fk=null};S.prototype.toString=function(){var a=Pa(this.constructor)+"#"+pb(this);null!==this.data&&(a+="("+Qa(this.data)+")");return a};S.prototype.Uk=function(a,b,c,d,e,f,g){var h=this.diagram;null!==h&&(a===Je&&"elements"===b?e instanceof V?Sj(e,function(a){Uj(h.partManager,a);Tj(h,a)}):lk(h,e):a===Ke&&"elements"===b&&(e instanceof V?Sj(e,function(a){Xj(h.partManager,a,h)}):nk(h,e)),h.hb(a,b,c,d,e,f,g))};
S.prototype.Ha=function(a){V.prototype.Ha.call(this,a);if(null!==this.data){for(var b=this.$.j,c=b.length,d=0;d<c;d++){var e=b[d];e instanceof V&&Sj(e,function(a){null!==a.data&&a.Ha()})}for(b=this.adornments;b.next();)b.value.Ha(a)}};S.prototype.updateRelationshipsFromData=function(){null!==this.data&&this.diagram.partManager.updateRelationshipsFromData(this)};S.prototype.Fk=function(a){F&&A(a,"string",S,"findAdornment:category");var b=this.Wf;return null===b?null:b.K(a)};
S.prototype.Rh=function(a,b){if(null!==b){F&&(A(a,"string",S,"addAdornment:category"),x(b,Te,S,"addAdornment:ad"));var c=null,d=this.Wf;null!==d&&(c=d.K(a));if(c!==b){if(null!==c){var e=c.diagram;null!==e&&e.remove(c)}null===d&&(this.Wf=d=new Db);b.Yf!==a&&(b.category=a);d.add(a,b);a=this.diagram;null!==a&&(a.add(b),a=b.adornedObject,null!==a&&(a=a.tj(),null!==a&&(b.data=a.data)))}}};
S.prototype.Sf=function(a){F&&A(a,"string",S,"removeAdornment:category");var b=this.Wf;if(null!==b){var c=b.K(a);if(null!==c){var d=c.diagram;null!==d&&d.remove(c)}b.remove(a);0===b.count&&(this.Wf=null)}};S.prototype.xk=function(){var a=this.Wf;if(null!==a){var b=La();for(a=a.iterator;a.next();)b.push(a.key);a=b.length;for(var c=0;c<a;c++)this.Sf(b[c]);Oa(b)}};
S.prototype.updateAdornments=function(){var a=this.diagram;if(null!==a){for(var b=this.adornments;b.next();){var c=b.value;c.v();c.placeholder&&c.placeholder.v()}a:{if(this.isSelected&&this.selectionAdorned&&(b=this.selectionObject,null!==b&&this.actualBounds.o()&&this.isVisible()&&b.Rf()&&b.actualBounds.o())){c=this.Fk("Selection");if(null===c){c=this.selectionAdornmentTemplate;null===c&&(c=this.$h()?a.linkSelectionAdornmentTemplate:this instanceof Hf?a.groupSelectionAdornmentTemplate:a.nodeSelectionAdornmentTemplate);
if(!(c instanceof Te))break a;Lg(c);c=c.copy();null!==c&&(this.$h()&&this.selectionObject===this.path&&(c.type=V.Link),c.adornedObject=b)}if(null!==c){c.type===V.Link&&c.v();this.Rh("Selection",c);break a}}this.Sf("Selection")}Lo(this,a);for(b=this.adornments;b.next();)b.value.Ha()}};S.prototype.Rb=function(){var a=this.diagram;null!==a&&(fj(a),0!==(this.F&16384)!==!0&&(this.F|=16384,a.Jb()))};function xi(a){0!==(a.F&16384)!==!1&&(a.updateAdornments(),a.F&=-16385)}
function Lo(a,b){b.toolManager.mouseDownTools.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.toolManager.updateAdornments(a)}function Mo(a){if(!1===Hj(a)){No(a,!0);a.Ml();var b=a.diagram;null!==b&&(b.xd.add(a),b.Jb())}}function Oo(a){a.F|=2097152;if(!1!==Hj(a)){var b=a.position,c=a.location;c.o()&&b.o()||Po(a,b,c);c=a.Cb;var d=L.alloc().assign(c);c.ka();c.x=b.x;c.y=b.y;c.freeze();a.pu(d,c);L.free(d);No(a,!1)}}S.prototype.move=function(a,b){!0===b?this.location=a:this.position=a};
S.prototype.moveTo=function(a,b,c){a=J.allocAt(a,b);this.move(a,c);J.free(a)};S.prototype.isVisible=function(){if(!this.visible)return!1;var a=this.layer;if(null!==a){if(!a.visible)return!1;a=a.diagram;if(null!==a&&a.animationManager.ou(this))return!0}a=this.containingGroup;return null===a||a.isSubGraphExpanded&&a.isVisible()?!0:!1};t=S.prototype;t.Ub=function(a){var b=this.diagram;a?(this.D(4),this.Rb(),null!==b&&b.xd.add(this)):(this.D(8),this.xk());this.Zh();null!==b&&(b.Ua(),b.P())};
t.gb=function(a){if(this.name===a)return this;var b=this.fk;null===b&&(this.fk=b=new Db);if(null!==b.K(a))return b.K(a);var c=V.prototype.gb.call(this,a);if(null!==c)return b.set(a,c),c;b.set(a,null);return null};t.Of=function(a,b,c){void 0===c&&(c=new J);b=b.Sb()?Mc:b;var d=a.naturalBounds;c.h(d.width*b.x+b.offsetX,d.height*b.y+b.offsetY);if(null===a||a===this)return c;a.transform.ya(c);for(a=a.panel;null!==a&&a!==this;)a.transform.ya(c),a=a.panel;this.og.ya(c);c.offset(-this.uc.x,-this.uc.y);return c};
t.Km=function(a){void 0===a&&(a=new L);return a.assign(this.actualBounds)};t.Ya=function(){!0===Fj(this)&&this.measure(Infinity,Infinity);this.arrange()};function Qj(a,b){var c=a.rz;isNaN(a.vh)&&(a.vh=un(a));var d=a.vh;var e=2*d;if(!a.isShadowed)return c.h(b.x-1-d,b.y-1-d,b.width+2+e,b.height+2+e),c;d=b.x;e=b.y;var f=b.width;b=b.height;var g=a.shadowBlur;a=a.shadowOffset;f+=g;b+=g;d-=g/2;e-=g/2;0<a.x?f+=a.x:(d+=a.x,f-=a.x);0<a.y?b+=a.y:(e+=a.y,b-=a.y);c.h(d-1,e-1,f+2,b+2);return c}
S.prototype.arrange=function(){if(!1===Gj(this))Oo(this);else{zl(this,!1);var a=this.Cb,b=L.alloc();b.assign(a);a.ka();var c=Jg(this);this.Th(0,0,this.uc.width,this.uc.height);var d=this.position;Po(this,d,this.location);a.x=d.x;a.y=d.y;a.freeze();this.pu(b,a);b.A(a)?this.Md(c):!this.bc()||K.C(b.width,a.width)&&K.C(b.height,a.height)||0<=this.Mx&&this.D(16);L.free(b);No(this,!1)}};t=S.prototype;
t.pu=function(a,b){var c=this.diagram;if(null!==c){var d=!1;if(!1===c.Fi&&a.o()){var e=L.alloc();e.assign(c.documentBounds);e.Ww(c.padding);a.x>e.x&&a.y>e.y&&a.right<e.right&&a.bottom<e.bottom&&b.x>e.x&&b.y>e.y&&b.right<e.right&&b.bottom<e.bottom&&(d=!0);L.free(e)}0!==(this.F&65536)!==!0&&a.A(b)||Vj(this,d,c);c.P();jc(a,b)||(this instanceof U&&!c.undoManager.isUndoingRedoing&&this.sd(),this.Zh())}};
t.Rw=function(a,b){if(this.$h()||!a.o())return!1;var c=this.diagram;null!==c&&Qo(this,c,a,b);this.ra=a;this.F&=-2097153;var d=this.pg;!d.o()||null!==c&&!c.animationManager.isTicking&&c.undoManager.isUndoingRedoing||(c=d.copy(),d.h(d.x+(a.x-b.x),d.y+(a.y-b.y)),this.g("location",c,d.copy()));!1===Hj(this)&&!1===Gj(this)&&(Mo(this),Oo(this));return!0};function Qo(a,b,c,d){null===b||a instanceof Te||(b=b.animationManager,b.rf&&ai(b,a,d.copy(),c.copy()))}
t.ur=function(a,b,c){var d=this.pg,e=this.ra;if(c){if(d.x===a&&d.y===b)return;Hj(this)||Gj(this)?e.h(NaN,NaN):e.h(e.x+a-d.x,e.y+b-d.y);d.h(a,b)}else{if(e.x===a&&e.y===b)return;Hj(this)||Gj(this)?this.yu():d.h(d.x+a-e.x,d.y+b-e.y);e.h(a,b)}Mo(this)};t.yu=function(){this.F&=-2097153;Mo(this)};
function Po(a,b,c){var d=J.alloc(),e=a.locationSpot,f=a.locationObject;e.Sb()&&v("determineOffset: Part's locationSpot must be real: "+e.toString());var g=f.naturalBounds,h=f instanceof Yf?f.strokeWidth:0;d.Wk(0,0,g.width+h,g.height+h,e);if(f!==a)for(d.offset(-h/2,-h/2),f.transform.ya(d),e=f.panel;null!==e&&e!==a;)e.transform.ya(d),e=e.panel;a.og.ya(d);d.offset(-a.uc.x,-a.uc.y);e=a.diagram;f=c.o();g=b.o();f&&g?0!==(a.F&2097152)?Ro(a,b,c,e,d):So(a,b,c,e,d):f?Ro(a,b,c,e,d):g&&So(a,b,c,e,d);a.F|=2097152;
J.free(d);a.Ml()}function Ro(a,b,c,d,e){var f=b.x,g=b.y;b.h(c.x-e.x,c.y-e.y);null!==d&&(c=d.animationManager,(d=c.isAnimating)||!c.rf||a instanceof Te||ai(c,a,new J(f,g),b),d||b.x===f&&b.y===g||a.g("position",new J(f,g),b.copy()))}function So(a,b,c,d,e){var f=c.copy();c.h(b.x+e.x,b.y+e.y);c.A(f)||null===d||a.g("location",f,c.copy())}
function Vj(a,b,c){Bl(a,!1);a instanceof U&&Mk(c,a);a.layer.isTemporary||b||c.Ua();b=a.Cb;var d=c.viewportBounds;d.o()?Jg(a)?(nc(b,d)||a.Md(!1),a.updateAdornments()):b.Rc(d)?(a.Md(!0),a.updateAdornments()):a.Rb():c.Hi=!0}t.Cj=function(){return!0};t.bc=function(){return!0};t.$h=function(){return!1};t.Qf=function(){return!0};
function To(a,b,c,d){b.constructor===a.constructor||Uo||(Uo=!0,Ca('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),Ca("  Old class: "+Pa(a.constructor)+", new class: "+Pa(b.constructor)+", part: "+a.toString()));a.xk();var e=a.data;c=a.layerName;var f=a.isSelected,g=a.isHighlighted,h=!0,k=!0,l=!1;a instanceof U&&(h=a.isTreeLeaf,k=a.isTreeExpanded,l=a.wasTreeExpanded);b.Kf(a);b.cloneProtected(a);a.Yf=d;a.v();a.P();b=a.diagram;d=!0;null!==b&&(d=b.skipsUndoManager,
b.skipsUndoManager=!0);a.qb=e;a.F=f?a.F|4096:a.F&-4097;a.F=g?a.F|524288:a.F&-524289;a instanceof U&&(a.T=h?a.T|4:a.T&-5,a.T=k?a.T|1:a.T&-2,a.T=l?a.T|2:a.T&-3);null!==e&&a.Ha();e=a.layerName;e!==c&&(a.th=c,a.layerName=e);null!==b&&(b.skipsUndoManager=d);a.bc()&&a.D(64)}S.prototype.canCopy=function(){if(!this.copyable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowCopy)return!1;a=a.diagram;return null===a?!0:a.allowCopy?!0:!1};
S.prototype.canDelete=function(){if(!this.deletable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowDelete)return!1;a=a.diagram;return null===a?!0:a.allowDelete?!0:!1};S.prototype.canEdit=function(){if(!this.textEditable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowTextEdit)return!1;a=a.diagram;return null===a?!0:a.allowTextEdit?!0:!1};
S.prototype.canGroup=function(){if(!this.groupable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowGroup)return!1;a=a.diagram;return null===a?!0:a.allowGroup?!0:!1};S.prototype.canMove=function(){if(!this.movable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowMove)return!1;a=a.diagram;return null===a?!0:a.allowMove?!0:!1};
S.prototype.canReshape=function(){if(!this.reshapable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowReshape)return!1;a=a.diagram;return null===a?!0:a.allowReshape?!0:!1};S.prototype.canResize=function(){if(!this.resizable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowResize)return!1;a=a.diagram;return null===a?!0:a.allowResize?!0:!1};
S.prototype.canRotate=function(){if(!this.rotatable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRotate)return!1;a=a.diagram;return null===a?!0:a.allowRotate?!0:!1};S.prototype.canSelect=function(){if(!this.selectable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowSelect)return!1;a=a.diagram;return null===a?!0:a.allowSelect?!0:!1};function Hj(a){return 0!==(a.F&32768)}function No(a,b){a.F=b?a.F|32768:a.F&-32769}function Bl(a,b){a.F=b?a.F|65536:a.F&-65537}
function Jg(a){return 0!==(a.F&131072)}t=S.prototype;t.Md=function(a){this.F=a?this.F|131072:this.F&-131073};function Vo(a,b){a.F=b?a.F|1048576:a.F&-1048577}t.Zh=function(){var a=this.containingGroup;null!==a&&(a.v(),null!==a.placeholder&&a.placeholder.v(),a.sd())};t.P=function(){var a=this.diagram;null!==a&&!Gj(this)&&!Hj(this)&&this.isVisible()&&this.Cb.o()&&a.P(Qj(this,this.Cb))};
t.v=function(){V.prototype.v.call(this);var a=this.diagram;null!==a&&(a.xd.add(this),this instanceof U&&null!==this.labeledLink&&Ql(this.labeledLink),a.Jb(!0))};t.Xq=function(a){a||(a=this.yi,null!==a&&Wo(a,this))};t.Yq=function(a){a||(a=this.yi,null!==a&&Xo(a,this))};t.Dk=function(){var a=this.data;if(null!==a){var b=this.diagram;null!==b&&(b=b.model,null!==b&&b.$m(a))}};t.qA=function(){return Yo(this,this)};
function Yo(a,b){var c=b.containingGroup;return null!==c?1+Yo(a,c):b instanceof U&&(b=b.labeledLink,null!==b)?Yo(a,b):0}t.tA=function(){return Zo(this,this)};function Zo(a,b){var c=b.containingGroup;return null!==c||b instanceof U&&(c=b.labeledLink,null!==c)?Zo(a,c):b}t.Jd=function(a){return a instanceof Hf?$o(this,this,a):!1};function $o(a,b,c){if(b===c||null===c)return!1;var d=b.containingGroup;return null===d||d!==c&&!$o(a,d,c)?b instanceof U&&(b=b.labeledLink,null!==b)?$o(a,b,c):!1:!0}
t.By=function(a){if(null===a)return null;F&&x(a,S,S,"findCommonContainingGroup:other");if(this===a)return this.containingGroup;for(var b=this;null!==b;){b instanceof Hf&&Vo(b,!0);if(b instanceof U){var c=b.labeledLink;null!==c&&(b=c)}b=b.containingGroup}c=null;for(b=a;null!==b;){if(0!==(b.F&1048576)){c=b;break}b instanceof U&&(a=b.labeledLink,null!==a&&(b=a));b=b.containingGroup}for(b=this;null!==b;)b instanceof Hf&&Vo(b,!1),b instanceof U&&(a=b.labeledLink,null!==a&&(b=a)),b=b.containingGroup;return c};
S.prototype.canLayout=function(){if(!this.isLayoutPositioned||!this.isVisible())return!1;var a=this.layer;return null!==a&&a.isTemporary||this instanceof U&&this.isLinkLabel?!1:!0};
S.prototype.D=function(a){void 0===a&&(a=16777215);if(this.isLayoutPositioned&&0!==(a&this.layoutConditions)){var b=this.layer;null!==b&&b.isTemporary||this instanceof U&&this.isLinkLabel?b=!1:(b=this.diagram,b=null!==b&&b.undoManager.isUndoingRedoing?!1:!0)}else b=!1;if(b)if(b=this.yi,null!==b){var c=b.layout;null!==c?c.D():b.D(a)}else a=this.diagram,null!==a&&(a=a.layout,null!==a&&a.D())};function Wj(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.isTemporary?!1:!0}
function fl(a,b,c,d,e,f){void 0===f&&(f=null);if(!(a.contains(b)||null!==f&&!f(b)||b instanceof Te))if(a.add(b),b instanceof U){if(c&&b instanceof Hf)for(var g=b.memberParts;g.next();)fl(a,g.value,c,d,e,f);if(!1!==e)for(g=b.linksConnected;g.next();){var h=g.value;if(!a.contains(h)){var k=h.fromNode,l=h.toNode;k=null===k||a.contains(k);l=null===l||a.contains(l);(e?k&&l:k||l)&&fl(a,h,c,d,e,f)}}if(1<d)for(b=b.jw();b.next();)fl(a,b.value,c,d-1,e,f)}else if(b instanceof R)for(b=b.labelNodes;b.next();)fl(a,
b.value,c,d,e,f)}
ma.Object.defineProperties(S.prototype,{key:{configurable:!0,get:function(){var a=this.diagram;if(null!==a)return a.model.pa(this.data)}},adornments:{configurable:!0,get:function(){return null===this.Wf?lb:this.Wf.iteratorValues}},layer:{configurable:!0,get:function(){return this.Pi}},diagram:{configurable:!0,get:function(){var a=this.Pi;return null!==a?a.diagram:null}},layerName:{configurable:!0,get:function(){return this.th},set:function(a){var b=
this.th;if(b!==a){A(a,"string",S,"layerName");var c=this.diagram;if(null===c||null!==c.Hm(a)&&!c.partManager.addsToTemporaryLayer)if(this.th=a,null!==c&&c.Ua(),this.g("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.diagram,null!==c&&(a=c.Hm(a),null!==a&&a!==b))){var d=b.Qc(-1,this,!0);0<=d&&c.hb(Ke,"parts",b,this,null,d,!0);d=a.yj(99999999,this,!0);b.visible!==a.visible&&this.Ub(a.visible);0<=d&&c.hb(Je,"parts",a,null,this,!0,d);d=this.layerChanged;if(null!==d){var e=c.ba;c.ba=!0;d(this,
b,a);c.ba=e}}}}},layerChanged:{configurable:!0,get:function(){return this.Qo},set:function(a){var b=this.Qo;b!==a&&(null!==a&&A(a,"function",S,"layerChanged"),this.Qo=a,this.g("layerChanged",b,a))}},zOrder:{configurable:!0,get:function(){return this.Eq},set:function(a){var b=this.Eq;if(b!==a){A(a,"number",S,"zOrder");this.Eq=a;var c=this.layer;null!==c&&Ai(c,-1,this);this.g("zOrder",b,a);a=this.diagram;null!==a&&a.P()}}},locationObject:{configurable:!0,get:function(){if(null===
this.pf){var a=this.locationObjectName;""!==a?(a=this.gb(a),null!==a?this.pf=a:this.pf=this):this instanceof Te?this.type!==V.Link&&null!==this.placeholder?this.pf=this.placeholder:this.pf=this:this.pf=this}return this.pf.visible?this.pf:this}},minLocation:{configurable:!0,get:function(){return this.hp},set:function(a){var b=this.hp;b.A(a)||(F&&x(a,J,S,"minLocation"),this.hp=a=a.J(),this.g("minLocation",b,a))}},maxLocation:{configurable:!0,get:function(){return this.Zo},
set:function(a){var b=this.Zo;b.A(a)||(F&&x(a,J,S,"maxLocation"),this.Zo=a=a.J(),this.g("maxLocation",b,a))}},locationObjectName:{configurable:!0,get:function(){return this.Xo},set:function(a){var b=this.Xo;b!==a&&(F&&A(a,"string",S,"locationObjectName"),this.Xo=a,this.pf=null,this.v(),this.g("locationObjectName",b,a))}},locationSpot:{configurable:!0,get:function(){return this.Yo},set:function(a){var b=this.Yo;b.A(a)||(F&&(x(a,M,S,"locationSpot"),a.cb()||v("Part.locationSpot must be a specific Spot value, not: "+
a)),this.Yo=a=a.J(),this.v(),this.g("locationSpot",b,a))}},location:{configurable:!0,get:function(){return this.pg},set:function(a){F&&x(a,J,S,"location");var b=a.x,c=a.y,d=this.pg,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(a=a.copy(),b=a,this.$h()?b=!1:(this.pg=b,this.F|=2097152,!1===Gj(this)&&(Mo(this),c=this.ra,c.o()&&(e=this.diagram,null===e||e.animationManager.isTicking||!e.undoManager.isUndoingRedoing))&&(f=c.copy(),c.h(c.x+(b.x-d.x),c.y+(b.y-d.y)),
Qo(this,e,c,f),this.g("position",f,c.copy())),b=!0),b&&this.g("location",d.copy(),a.copy()))}},category:{configurable:!0,get:function(){return this.Yf},set:function(a){var b=this.Yf;if(b!==a){A(a,"string",S,"category");var c=this.diagram,d=this.data,e=null;if(null!==c&&null!==d&&!(this instanceof Te)){var f=c.model.undoManager;f.isEnabled&&!f.isUndoingRedoing&&(e=this.clone(),e.$.addAll(this.$))}this.Yf=a;this.g("category",b,a);null===c||null===d||this instanceof Te?this instanceof Te&&
(e=this.adornedPart,null!==e&&(a=e.Wf,null!==a&&a.remove(b),e.Rh(this.category,this))):(f=c.model,f.undoManager.isUndoingRedoing||(this.$h()?(c.partManager.setLinkCategoryForData(d,a),c=c.partManager.findLinkTemplateForCategory(a),null!==c&&(Lg(c),c=c.copy(),null!==c&&To(this,c,b,a))):(null!==f&&f.gn(d,a),c=ap(c.partManager,d,a),null!==c&&(Lg(c),c=c.copy(),null===c||c instanceof R||(d=this.location.copy(),To(this,c,b,a),this.location.o()||(this.location=d)))),null!==e&&(b=this.clone(),b.$.addAll(this.$),
this.g("self",e,b))))}}},self:{configurable:!0,get:function(){return this},set:function(a){To(this,a,this.category,a.category)}},copyable:{configurable:!0,get:function(){return 0!==(this.F&1)},set:function(a){var b=0!==(this.F&1);b!==a&&(F&&A(a,"boolean",S,"copyable"),this.F^=1,this.g("copyable",b,a))}},deletable:{configurable:!0,get:function(){return 0!==(this.F&2)},set:function(a){var b=0!==(this.F&2);b!==a&&(F&&A(a,"boolean",S,"deletable"),this.F^=2,this.g("deletable",
b,a))}},textEditable:{configurable:!0,get:function(){return 0!==(this.F&4)},set:function(a){var b=0!==(this.F&4);b!==a&&(F&&A(a,"boolean",S,"textEditable"),this.F^=4,this.g("textEditable",b,a),this.Rb())}},groupable:{configurable:!0,get:function(){return 0!==(this.F&8)},set:function(a){var b=0!==(this.F&8);b!==a&&(F&&A(a,"boolean",S,"groupable"),this.F^=8,this.g("groupable",b,a))}},movable:{configurable:!0,get:function(){return 0!==(this.F&16)},set:function(a){var b=
0!==(this.F&16);b!==a&&(F&&A(a,"boolean",S,"movable"),this.F^=16,this.g("movable",b,a))}},selectionAdorned:{configurable:!0,get:function(){return 0!==(this.F&32)},set:function(a){var b=0!==(this.F&32);b!==a&&(F&&A(a,"boolean",S,"selectionAdorned"),this.F^=32,this.g("selectionAdorned",b,a),this.Rb())}},isInDocumentBounds:{configurable:!0,get:function(){return 0!==(this.F&64)},set:function(a){var b=0!==(this.F&64);if(b!==a){F&&A(a,"boolean",S,"isInDocumentBounds");this.F^=
64;var c=this.diagram;null!==c&&c.Ua();this.g("isInDocumentBounds",b,a)}}},isLayoutPositioned:{configurable:!0,get:function(){return 0!==(this.F&128)},set:function(a){var b=0!==(this.F&128);b!==a&&(F&&A(a,"boolean",S,"isLayoutPositioned"),this.F^=128,this.g("isLayoutPositioned",b,a),this.D(a?4:8))}},selectable:{configurable:!0,get:function(){return 0!==(this.F&256)},set:function(a){var b=0!==(this.F&256);b!==a&&(F&&A(a,"boolean",S,"selectable"),this.F^=256,this.g("selectable",
b,a),this.Rb())}},reshapable:{configurable:!0,get:function(){return 0!==(this.F&512)},set:function(a){var b=0!==(this.F&512);b!==a&&(F&&A(a,"boolean",S,"reshapable"),this.F^=512,this.g("reshapable",b,a),this.Rb())}},resizable:{configurable:!0,get:function(){return 0!==(this.F&1024)},set:function(a){var b=0!==(this.F&1024);b!==a&&(F&&A(a,"boolean",S,"resizable"),this.F^=1024,this.g("resizable",b,a),this.Rb())}},rotatable:{configurable:!0,get:function(){return 0!==
(this.F&2048)},set:function(a){var b=0!==(this.F&2048);b!==a&&(F&&A(a,"boolean",S,"rotatable"),this.F^=2048,this.g("rotatable",b,a),this.Rb())}},isSelected:{configurable:!0,get:function(){return 0!==(this.F&4096)},set:function(a){var b=0!==(this.F&4096);if(b!==a){F&&A(a,"boolean",S,"isSelected");var c=this.diagram;if(!a||this.canSelect()&&!(null!==c&&c.selection.count>=c.maxSelectionCount)){this.F^=4096;var d=!1;if(null!==c){d=c.skipsUndoManager;c.skipsUndoManager=!0;var e=c.selection;
e.ka();a?e.add(this):e.remove(this);e.freeze()}this.g("isSelected",b,a);this.Rb();a=this.selectionChanged;null!==a&&a(this);null!==c&&(c.Jb(),c.skipsUndoManager=d)}}}},isHighlighted:{configurable:!0,get:function(){return 0!==(this.F&524288)},set:function(a){var b=0!==(this.F&524288);if(b!==a){F&&A(a,"boolean",S,"isHighlighted");this.F^=524288;var c=this.diagram;null!==c&&(c=c.highlighteds,c.ka(),a?c.add(this):c.remove(this),c.freeze());this.g("isHighlighted",b,a);this.P();a=this.highlightedChanged;
null!==a&&a(this)}}},isShadowed:{configurable:!0,get:function(){return 0!==(this.F&8192)},set:function(a){var b=0!==(this.F&8192);b!==a&&(F&&A(a,"boolean",S,"isShadowed"),this.F^=8192,this.g("isShadowed",b,a),this.P())}},isAnimated:{configurable:!0,get:function(){return 0!==(this.F&262144)},set:function(a){var b=0!==(this.F&262144);b!==a&&(F&&A(a,"boolean",S,"isAnimated"),this.F^=262144,this.g("isAnimated",b,a))}},highlightedChanged:{configurable:!0,get:function(){return this.Co},
set:function(a){var b=this.Co;b!==a&&(null!==a&&A(a,"function",S,"highlightedChanged"),this.Co=a,this.g("highlightedChanged",b,a))}},selectionObjectName:{configurable:!0,get:function(){return this.bq},set:function(a){var b=this.bq;b!==a&&(F&&A(a,"string",S,"selectionObjectName"),this.bq=a,this.Eh=null,this.g("selectionObjectName",b,a))}},selectionAdornmentTemplate:{configurable:!0,get:function(){return this.$p},set:function(a){var b=this.$p;b!==a&&(F&&x(a,Te,S,"selectionAdornmentTemplate"),
this.$p=a,this.g("selectionAdornmentTemplate",b,a))}},selectionObject:{configurable:!0,get:function(){if(null===this.Eh){var a=this.selectionObjectName;null!==a&&""!==a?(a=this.gb(a),null!==a?this.Eh=a:this.Eh=this):this instanceof R?(a=this.path,null!==a?this.Eh=a:this.Eh=this):this.Eh=this}return this.Eh}},selectionChanged:{configurable:!0,get:function(){return this.aq},set:function(a){var b=this.aq;b!==a&&(null!==a&&A(a,"function",S,"selectionChanged"),this.aq=a,this.g("selectionChanged",
b,a))}},resizeAdornmentTemplate:{configurable:!0,get:function(){return this.Lp},set:function(a){var b=this.Lp;b!==a&&(F&&x(a,Te,S,"resizeAdornmentTemplate"),this.Lp=a,this.g("resizeAdornmentTemplate",b,a))}},resizeObjectName:{configurable:!0,get:function(){return this.Np},set:function(a){var b=this.Np;b!==a&&(F&&A(a,"string",S,"resizeObjectName"),this.Np=a,this.g("resizeObjectName",b,a))}},resizeObject:{configurable:!0,get:function(){var a=this.resizeObjectName;
return""!==a&&(a=this.gb(a),null!==a)?a:this}},resizeCellSize:{configurable:!0,get:function(){return this.Mp},set:function(a){var b=this.Mp;b.A(a)||(F&&x(a,Hb,S,"resizeCellSize"),this.Mp=a=a.J(),this.g("resizeCellSize",b,a))}},rotateAdornmentTemplate:{configurable:!0,get:function(){return this.Pp},set:function(a){var b=this.Pp;b!==a&&(F&&x(a,Te,S,"rotateAdornmentTemplate"),this.Pp=a,this.g("rotateAdornmentTemplate",b,a))}},rotateObjectName:{configurable:!0,
get:function(){return this.Qp},set:function(a){var b=this.Qp;b!==a&&(F&&A(a,"string",S,"rotateObjectName"),this.Qp=a,this.g("rotateObjectName",b,a))}},rotateObject:{configurable:!0,get:function(){var a=this.rotateObjectName;return""!==a&&(a=this.gb(a),null!==a)?a:this}},rotationSpot:{configurable:!0,get:function(){return this.Rp},set:function(a){var b=this.Rp;b.A(a)||(F&&(x(a,M,S,"rotationSpot"),a===ld||a.cb()||v("Part.rotationSpot must be a specific Spot value or Spot.Default, not: "+
a)),this.Rp=a=a.J(),this.g("rotationSpot",b,a))}},text:{configurable:!0,get:function(){return this.Zb},set:function(a){var b=this.Zb;b!==a&&(F&&A(a,"string",S,"text"),this.Zb=a,this.g("text",b,a))}},containingGroup:{configurable:!0,get:function(){return this.yi},set:function(a){if(this.bc()){var b=this.yi;if(b!==a){F&&null!==a&&x(a,Hf,S,"containingGroup");null===a||this!==a&&!a.Jd(this)||(this===a&&v("Cannot make a Group a member of itself: "+this.toString()),v("Cannot make a Group indirectly contain itself: "+
this.toString()+" already contains "+a.toString()));this.D(2);var c=this.diagram;null!==b?Xo(b,this):this instanceof Hf&&null!==c&&c.Oh.remove(this);this.yi=a;null!==a?Wo(a,this):this instanceof Hf&&null!==c&&c.Oh.add(this);this.D(1);if(null!==c&&c.ba){var d=this.data,e=c.model;if(null!==d&&e.zj()){var f=e.pa(null!==a?a.data:null);e.tr(d,f)}}d=this.containingGroupChanged;null!==d&&(e=!0,null!==c&&(e=c.ba,c.ba=!0),d(this,b,a),null!==c&&(c.ba=e));if(this instanceof Hf)for(c=new I,fl(c,this,!0,0,!0),
c=c.iterator;c.next();)if(d=c.value,d instanceof U)for(d=d.linksConnected;d.next();)bp(d.value);if(this instanceof U){for(c=this.linksConnected;c.next();)bp(c.value);c=this.labeledLink;null!==c&&bp(c)}this.g("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&Ai(b,-1,a))}}else v("cannot set the Part.containingGroup of a Link or Adornment")}},containingGroupChanged:{configurable:!0,get:function(){return this.Mn},set:function(a){var b=this.Mn;b!==a&&(null!==a&&A(a,"function",S,"containingGroupChanged"),
this.Mn=a,this.g("containingGroupChanged",b,a))}},isTopLevel:{configurable:!0,get:function(){return null!==this.containingGroup||this instanceof U&&null!==this.labeledLink?!1:!0}},layoutConditions:{configurable:!0,get:function(){return this.Ro},set:function(a){var b=this.Ro;b!==a&&(F&&A(a,"number",S,"layoutConditions"),this.Ro=a,this.g("layoutConditions",b,a))}},dragComputation:{configurable:!0,get:function(){return this.eo},set:function(a){var b=this.eo;
b!==a&&(null!==a&&A(a,"function",S,"dragComputation"),this.eo=a,this.g("dragComputation",b,a))}},shadowOffset:{configurable:!0,get:function(){return this.gq},set:function(a){var b=this.gq;b.A(a)||(F&&x(a,J,S,"shadowOffset"),this.gq=a=a.J(),this.P(),this.g("shadowOffset",b,a))}},shadowColor:{configurable:!0,get:function(){return this.fq},set:function(a){var b=this.fq;b!==a&&(F&&A(a,"string",S,"shadowColor"),this.fq=a,this.P(),this.g("shadowColor",b,a))}},shadowBlur:{configurable:!0,
enumerable:!0,get:function(){return this.wf},set:function(a){var b=this.wf;b!==a&&(F&&A(a,"number",S,"shadowBlur"),this.wf=a,this.P(),this.g("shadowBlur",b,a))}}});S.prototype.invalidateLayout=S.prototype.D;S.prototype.findCommonContainingGroup=S.prototype.By;S.prototype.isMemberOf=S.prototype.Jd;S.prototype.findTopLevelPart=S.prototype.tA;S.prototype.findSubGraphLevel=S.prototype.qA;S.prototype.ensureBounds=S.prototype.Ya;S.prototype.getDocumentBounds=S.prototype.Km;
S.prototype.getRelativePoint=S.prototype.Of;S.prototype.findObject=S.prototype.gb;S.prototype.moveTo=S.prototype.moveTo;S.prototype.invalidateAdornments=S.prototype.Rb;S.prototype.clearAdornments=S.prototype.xk;S.prototype.removeAdornment=S.prototype.Sf;S.prototype.addAdornment=S.prototype.Rh;S.prototype.findAdornment=S.prototype.Fk;S.prototype.updateTargetBindings=S.prototype.Ha;var Uo=!1;S.className="Part";S.LayoutNone=0;S.LayoutAdded=1;S.LayoutRemoved=2;S.LayoutShown=4;S.LayoutHidden=8;
S.LayoutNodeSized=16;S.LayoutGroupLayout=32;S.LayoutNodeReplaced=64;S.LayoutStandard=127;S.LayoutAll=16777215;function Te(a){S.call(this,a);this.F&=-257;this.th="Adornment";this.ne=null;this.Qx=0;this.gy=!1;this.l=[];this.Ra=null}la(Te,S);Te.prototype.toString=function(){var a=this.adornedPart;return"Adornment("+this.category+")"+(null!==a?a.toString():"")};Te.prototype.updateRelationshipsFromData=function(){};
Te.prototype.Mk=function(a){var b=this.adornedObject.part;if(b instanceof R&&this.adornedObject instanceof Yf){var c=b.path;b.Mk(a);a=c.geometry;b=this.$.j;c=b.length;for(var d=0;d<c;d++){var e=b[d];e.isPanelMain&&e instanceof Yf&&(e.ua=a)}}};Te.prototype.Cj=function(){var a=this.ne;if(null===a)return!0;a=a.part;return null===a||!Gj(a)};Te.prototype.bc=function(){return!1};
Te.prototype.Uk=function(a,b,c,d,e,f,g){if(a===Je&&"elements"===b)if(e instanceof Kg)null===this.Ra?this.Ra=e:F&&this.Ra!==e&&v("Cannot insert a second Placeholder into the visual tree of an Adornment.");else{if(e instanceof V){var h=e.Gm(function(a){return a instanceof Kg});h instanceof Kg&&(null===this.Ra?this.Ra=h:F&&this.Ra!==h&&v("Cannot insert a second Placeholder into the visual tree of an Adornment."))}}else a===Ke&&"elements"===b&&null!==this.Ra&&(d===this.Ra?this.Ra=null:d instanceof V&&
this.Ra.Sg(d)&&(this.Ra=null));S.prototype.Uk.call(this,a,b,c,d,e,f,g)};Te.prototype.updateAdornments=function(){};Te.prototype.Dk=function(){};
ma.Object.defineProperties(Te.prototype,{placeholder:{configurable:!0,get:function(){return this.Ra}},adornedObject:{configurable:!0,get:function(){return this.ne},set:function(a){F&&null!==a&&x(a,N,S,"adornedObject:value");var b=this.adornedPart,c=null;null!==a&&(c=a.part);null===b||null!==a&&b===c||b.Sf(this.category);this.ne=a;null!==c&&c.Rh(this.category,this)}},adornedPart:{configurable:!0,get:function(){var a=this.ne;return null!==a?a.part:null}},containingGroup:{configurable:!0,
enumerable:!0,get:function(){return null}}});Te.className="Adornment";function U(a){S.call(this,a);this.T=13;this.fb=new H;this.yq=this.Rl=this.Si=this.To=this.So=null;this.hl=Fc;this.yc=this.cf=null;this.Ip=cp;this.Ph=!1}la(U,S);U.prototype.cloneProtected=function(a){S.prototype.cloneProtected.call(this,a);a.T=this.T;a.T=this.T&-17;a.So=this.So;a.To=this.To;a.Si=this.Si;a.yq=this.yq;a.hl=this.hl.J();a.Ip=this.Ip};t=U.prototype;
t.Kf=function(a){S.prototype.Kf.call(this,a);a.sd();a.cf=this.cf;a.yc=null};function dp(a,b){null!==b&&(null===a.cf&&(a.cf=new I),a.cf.add(b))}function ep(a,b,c,d){if(null===b||null===a.cf)return null;for(var e=a.cf.iterator;e.next();){var f=e.value;if(f.mu===a&&f.xw===b&&f.Zy===c&&f.$y===d||f.mu===b&&f.xw===a&&f.Zy===d&&f.$y===c)return f}return null}t.NA=function(a,b,c){if(void 0===b||null===b)b="";if(void 0===c||null===c)c="";a=ep(this,a,b,c);null!==a&&a.Mm()};
t.Uk=function(a,b,c,d,e,f,g){a===Je&&"elements"===b?this.yc=null:a===Ke&&"elements"===b&&(this.yc=null);S.prototype.Uk.call(this,a,b,c,d,e,f,g)};t.sd=function(a){void 0===a&&(a=null);for(var b=this.linksConnected;b.next();){var c=b.value;null!==a&&a.contains(c)||(fp(this,c.fromPort),fp(this,c.toPort),c.Za())}};function Cl(a,b){for(var c=a.linksConnected;c.next();){var d=c.value;if(d.fromPort===b||d.toPort===b)fp(a,d.fromPort),fp(a,d.toPort),d.Za()}}
function fp(a,b){null!==b&&(b=b.Hp,null!==b&&b.Mm(),b=a.containingGroup,null===b||a.isVisible()||fp(b,b.port))}t.Cj=function(){return!0};U.prototype.getAvoidableRect=function(a){a.set(this.actualBounds);a.Fq(this.hl);return a};U.prototype.findVisibleNode=function(){for(var a=this;null!==a&&!a.isVisible();)a=a.containingGroup;return a};
U.prototype.isVisible=function(){if(!S.prototype.isVisible.call(this))return!1;var a=!0,b=Fi,c=this.diagram;if(null!==c){if(c.animationManager.ou(this))return!0;a=c.isTreePathToChildren;b=c.treeCollapsePolicy}if(b===Fi){if(a=this.Rg(),null!==a&&!a.isTreeExpanded)return!1}else if(b===Tk){if(a=a?this.gw():this.hw(),0<a.count&&a.all(function(a){return!a.isTreeExpanded}))return!1}else if(b===Uk&&(a=a?this.gw():this.hw(),0<a.count&&a.any(function(a){return!a.isTreeExpanded})))return!1;a=this.labeledLink;
return null!==a?a.isVisible():!0};U.prototype.Ub=function(a){S.prototype.Ub.call(this,a);for(var b=this.linksConnected;b.next();){var c=b.value;if(a&&null!==this.containingGroup){var d=c.Vq(this);null===d||d.Jd(this.containingGroup)||c.Za()}c.Ub(a)}};U.prototype.Cy=function(){var a=new I,b=new I;gp(this,this,a,b);return b.iterator};
function gp(a,b,c,d){if(null!==b&&!c.has(b)){c.add(b);var e=!0,f=a.diagram;null!==f&&(e=f.isTreePathToChildren);b.linksConnected.each(function(f){f.isTreeLink?(e?f.fromNode===b:f.toNode===b)&&gp(a,e?f.toNode:f.fromNode,c,d):d.add(f)})}}
U.prototype.findLinksConnected=function(a){void 0===a&&(a=null);if(null===a)return this.fb.iterator;F&&A(a,"string",U,"findLinksConnected:pid");var b=new nb(this.fb),c=this;b.predicate=function(b){return b.fromNode===c&&b.fromPortId===a||b.toNode===c&&b.toPortId===a};return b};t=U.prototype;t.Qq=function(a){void 0===a&&(a=null);F&&null!==a&&A(a,"string",U,"findLinksOutOf:pid");var b=new nb(this.fb),c=this;b.predicate=function(b){return b.fromNode!==c?!1:null===a?!0:b.fromPortId===a};return b};
t.Hd=function(a){void 0===a&&(a=null);F&&null!==a&&A(a,"string",U,"findLinksInto:pid");var b=new nb(this.fb),c=this;b.predicate=function(b){return b.toNode!==c?!1:null===a?!0:b.toPortId===a};return b};
t.fw=function(a){void 0===a&&(a=null);F&&null!==a&&A(a,"string",U,"findNodesConnected:pid");for(var b=null,c=null,d=this.fb.iterator;d.next();){var e=d.value;if(e.fromNode===this){if(null===a||e.fromPortId===a)e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new I,b.add(c),b.add(e)):c=e}else e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new I,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new mb(c):lb};
t.hw=function(a){void 0===a&&(a=null);F&&null!==a&&A(a,"string",U,"findNodesOutOf:pid");for(var b=null,c=null,d=this.fb.iterator;d.next();){var e=d.value;e.fromNode!==this||null!==a&&e.fromPortId!==a||(e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new I,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new mb(c):lb};
t.gw=function(a){void 0===a&&(a=null);F&&null!==a&&A(a,"string",U,"findNodesInto:pid");for(var b=null,c=null,d=this.fb.iterator;d.next();){var e=d.value;e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new I,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new mb(c):lb};
t.lA=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);F&&(x(a,U,U,"findLinksBetween:othernode"),null!==b&&A(b,"string",U,"findLinksBetween:pid"),null!==c&&A(c,"string",U,"findLinksBetween:otherpid"));var d=new nb(this.fb),e=this;d.predicate=function(d){return(d.fromNode!==e||d.toNode!==a||null!==b&&d.fromPortId!==b||null!==c&&d.toPortId!==c)&&(d.fromNode!==a||d.toNode!==e||null!==c&&d.fromPortId!==c||null!==b&&d.toPortId!==b)?!1:!0};return d};
t.mA=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);F&&(x(a,U,U,"findLinksTo:othernode"),null!==b&&A(b,"string",U,"findLinksTo:pid"),null!==c&&A(c,"string",U,"findLinksTo:otherpid"));var d=new nb(this.fb),e=this;d.predicate=function(d){return d.fromNode!==e||d.toNode!==a||null!==b&&d.fromPortId!==b||null!==c&&d.toPortId!==c?!1:!0};return d};
function hp(a,b,c){fp(a,c);var d=a.fb.contains(b);d||a.fb.add(b);if(!d||b.fromNode===b.toNode){var e=a.linkConnected;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.ba,g.ba=!0);e(a,b,c);null!==g&&(g.ba=f)}}!d&&b.isTreeLink&&(c=b.fromNode,b=b.toNode,null!==c&&null!==b&&c!==b&&(d=!0,a=a.diagram,null!==a&&(d=a.isTreePathToChildren),e=d?b:c,f=d?c:b,e.Ph||(e.Ph=f),!f.isTreeLeaf||null!==a&&a.undoManager.isUndoingRedoing||(d?c===f&&(f.isTreeLeaf=!1):b===f&&(f.isTreeLeaf=!1))))}
function ip(a,b,c){fp(a,c);var d=a.fb.remove(b),e=null;if(d||b.toNode===b.fromNode){var f=a.linkDisconnected;e=a.diagram;if(null!==f){var g=!0;null!==e&&(g=e.ba,e.ba=!0);f(a,b,c);null!==e&&(e.ba=g)}}d&&b.isTreeLink&&(c=!0,null!==e&&(c=e.isTreePathToChildren),a=c?b.toNode:b.fromNode,b=c?b.fromNode:b.toNode,null!==a&&(a.Ph=!1),null===b||b.isTreeLeaf||(0===b.fb.count?(b.Ph=null,null!==e&&e.undoManager.isUndoingRedoing||(b.isTreeLeaf=!0)):Sk(b)))}
function Sk(a){a.Ph=!1;if(0!==a.fb.count){var b=!0,c=a.diagram;if(null===c||!c.undoManager.isUndoingRedoing){null!==c&&(b=c.isTreePathToChildren);for(c=a.fb.iterator;c.next();){var d=c.value;if(d.isTreeLink)if(b){if(d.fromNode===a){a.isTreeLeaf=!1;return}}else if(d.toNode===a){a.isTreeLeaf=!1;return}}a.isTreeLeaf=!0}}}U.prototype.updateRelationshipsFromData=function(){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)};t=U.prototype;
t.Xq=function(a){S.prototype.Xq.call(this,a);a||(Sk(this),a=this.Rl,null!==a&&jp(a,this))};t.Yq=function(a){S.prototype.Yq.call(this,a);a||(a=this.Rl,null!==a&&null!==a.od&&(a.od.remove(this),a.v()))};
t.Dk=function(){if(0<this.fb.count){var a=this.diagram;if(null!==a)for(var b=null!==a.commandHandler?a.commandHandler.deletesConnectedLinks:!0,c=this.fb.copy().iterator;c.next();){var d=c.value;b?a.remove(d):(d.fromNode===this&&(d.fromNode=null),d.toNode===this&&(d.toNode=null))}}this.labeledLink=null;S.prototype.Dk.call(this)};
t.Xt=function(a){F&&A(a,"string",U,"findPort:pid");if(null===this.yc){if(""===a&&!1===this.Yh)return this;kp(this)}var b=this.yc.K(a);return null!==b||""!==a&&(b=this.yc.K(""),null!==b)?b:this};function kp(a){null===a.yc?a.yc=new Db:a.yc.clear();a.Yk(a,function(a,c){gm(a,c)});0===a.yc.count&&a.yc.add("",a)}function gm(a,b){var c=b.portId;null!==c&&null!==a.yc&&a.yc.add(c,b)}
function fm(a,b,c){var d=b.portId;if(null!==d&&(null!==a.yc&&a.yc.remove(d),b=a.diagram,null!==b&&c)){c=null;for(a=a.findLinksConnected(d);a.next();)d=a.value,null===c&&(c=La()),c.push(d);if(null!==c){for(a=0;a<c.length;a++)b.remove(c[a]);Oa(c)}}}
t.PA=function(a){if(null===a||a===this)return!1;var b=!0,c=this.diagram;null!==c&&(b=c.isTreePathToChildren);c=this;if(b)for(;c!==a;){b=null;for(var d=c.fb.iterator;d.next();){var e=d.value;if(e.isTreeLink&&(b=e.fromNode,b!==c&&b!==this))break}if(b===this||null===b||b===c)return!1;c=b}else for(;c!==a;){b=null;for(d=c.fb.iterator;d.next()&&(e=d.value,!e.isTreeLink||(b=e.toNode,b===c||b===this)););if(b===this||null===b||b===c)return!1;c=b}return!0};
t.xA=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this;if(a)for(;;){a=null;for(var c=b.fb.iterator;c.next();){var d=c.value;if(d.isTreeLink&&(a=d.fromNode,a!==b&&a!==this))break}if(a===this)return this;if(null===a||a===b)return b;b=a}else for(;;){a=null;for(c=b.fb.iterator;c.next()&&(d=c.value,!d.isTreeLink||(a=d.toNode,a===b||a===this)););if(a===this)return this;if(null===a||a===b)return b;b=a}};
t.iA=function(a){if(null===a)return null;F&&x(a,U,U,"findCommonTreeParent:other");if(this===a)return this;for(var b=this;null!==b;)Vo(b,!0),b=b.Rg();var c=null;for(b=a;null!==b;){if(0!==(b.F&1048576)){c=b;break}b=b.Rg()}for(b=this;null!==b;)Vo(b,!1),b=b.Rg();return c};
t.uj=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this.fb.iterator;if(a)for(;b.next();){if(a=b.value,a.isTreeLink&&a.fromNode!==this)return a}else for(;b.next();)if(a=b.value,a.isTreeLink&&a.toNode!==this)return a;return null};
t.Rg=function(){var a=this.Ph;if(null===a)return null;if(a instanceof U)return a;var b=!0;a=this.diagram;null!==a&&(b=a.isTreePathToChildren);a=this.fb.iterator;if(b)for(;a.next();){if(b=a.value,b.isTreeLink&&(b=b.fromNode,b!==this))return this.Ph=b}else for(;a.next();)if(b=a.value,b.isTreeLink&&(b=b.toNode,b!==this))return this.Ph=b;return this.Ph=null};t.vA=function(){function a(b,d){if(null!==b){d.add(b);var c=b.uj();null!==c&&(d.add(c),a(b.Rg(),d))}}var b=new I;a(this,b);return b};
t.uA=function(){return lp(this,this)};function lp(a,b){b=b.Rg();return null===b?0:1+lp(a,b)}t.Sq=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=new nb(this.fb);var c=this;b.predicate=a?function(a){return a.isTreeLink&&a.fromNode===c?!0:!1}:function(a){return a.isTreeLink&&a.toNode===c?!0:!1};return b};
t.jw=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);var c=b=null,d=this.fb.iterator;if(a)for(;d.next();)a=d.value,a.isTreeLink&&a.fromNode===this&&(a=a.toNode,null!==b?b.add(a):null!==c&&c!==a?(b=new H,b.add(c),b.add(a)):c=a);else for(;d.next();)a=d.value,a.isTreeLink&&a.toNode===this&&(a=a.fromNode,null!==b?b.add(a):null!==c&&c!==a?(b=new H,b.add(c),b.add(a)):c=a);return null!==b?b.iterator:null!==c?new mb(c):lb};
t.wA=function(a){void 0===a&&(a=Infinity);A(a,"number",U,"findTreeParts:level");var b=new I;fl(b,this,!1,a,!0);return b};U.prototype.collapseTree=function(a){void 0===a&&(a=1);C(a,U,"collapseTree:level");1>a&&(a=1);var b=this.diagram;if(null!==b&&!b.Ue){b.Ue=!0;var c=new I;c.add(this);mp(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===Fi);b.Ue=!1}};
function mp(a,b,c,d,e,f,g){if(1<d)for(var h=c?a.Qq():a.Hd();h.next();){var k=h.value;k.isTreeLink&&(k=k.Vq(a),null===k||k===a||b.contains(k)||(b.add(k),mp(k,b,c,d-1,e,f,g)))}else np(a,b,c,e,f,g)}
function np(a,b,c,d,e,f){for(var g=e===a?!0:a.isTreeExpanded,h=c?a.Qq():a.Hd();h.next();){var k=h.value;if(k.isTreeLink&&(k=k.Vq(a),null!==k&&k!==a)){var l=b.contains(k);l||b.add(k);g&&(f&&d.tk(k,e),k.Zh(),k.Ub(!1));k.isTreeExpanded&&(k.wasTreeExpanded=k.isTreeExpanded,l||np(k,b,c,d,e,f))}}a.isTreeExpanded=!1}
U.prototype.expandTree=function(a){void 0===a&&(a=2);C(a,U,"expandTree:level");2>a&&(a=2);var b=this.diagram;if(null!==b&&!b.Ue){b.Ue=!0;var c=new I;c.add(this);op(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===Fi);b.Ue=!1}};
function op(a,b,c,d,e,f,g){for(var h=f===a?!1:a.isTreeExpanded,k=c?a.Qq():a.Hd();k.next();){var l=k.value;l.isTreeLink&&(h||l.kd||l.Za(),l=l.Vq(a),null!==l&&l!==a&&!b.contains(l)&&(b.add(l),h||(l.Ub(!0),l.Zh(),g&&e.vk(l,f)),2<d||l.wasTreeExpanded))&&(l.wasTreeExpanded=!1,op(l,b,c,d-1,e,f,g))}a.isTreeExpanded=!0}
ma.Object.defineProperties(U.prototype,{portSpreading:{configurable:!0,get:function(){return this.Ip},set:function(a){var b=this.Ip;b!==a&&(F&&hb(a,U,U,"portSpreading"),this.Ip=a,this.g("portSpreading",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.sd())}},avoidable:{configurable:!0,get:function(){return 0!==(this.T&8)},set:function(a){var b=0!==(this.T&8);if(b!==a){F&&A(a,"boolean",U,"avoidable");this.T^=8;var c=this.diagram;null!==c&&Mk(c,this);this.g("avoidable",
b,a)}}},avoidableMargin:{configurable:!0,get:function(){return this.hl},set:function(a){"number"===typeof a?a=new lc(a):x(a,lc,U,"avoidableMargin");var b=this.hl;if(!b.A(a)){this.hl=a=a.J();var c=this.diagram;null!==c&&Mk(c,this);this.g("avoidableMargin",b,a)}}},linksConnected:{configurable:!0,get:function(){return this.fb.iterator}},linkConnected:{configurable:!0,get:function(){return this.So},set:function(a){var b=this.So;b!==a&&(null!==a&&A(a,"function",
U,"linkConnected"),this.So=a,this.g("linkConnected",b,a))}},linkDisconnected:{configurable:!0,get:function(){return this.To},set:function(a){var b=this.To;b!==a&&(null!==a&&A(a,"function",U,"linkDisconnected"),this.To=a,this.g("linkDisconnected",b,a))}},linkValidation:{configurable:!0,get:function(){return this.Si},set:function(a){var b=this.Si;b!==a&&(null!==a&&A(a,"function",U,"linkValidation"),this.Si=a,this.g("linkValidation",b,a))}},isLinkLabel:{configurable:!0,
get:function(){return null!==this.Rl}},labeledLink:{configurable:!0,get:function(){return this.Rl},set:function(a){var b=this.Rl;if(b!==a){F&&null!==a&&x(a,R,U,"labeledLink");var c=this.diagram,d=this.data;if(null!==b){null!==b.od&&(b.od.remove(this),b.v());if(null!==c&&null!==d&&!c.undoManager.isUndoingRedoing){var e=b.data,f=c.model;if(null!==e&&f.Bj()){var g=f.pa(d);void 0!==g&&f.az(e,g)}}this.containingGroup=null}this.Rl=a;null!==a&&(jp(a,this),null===c||null===d||c.undoManager.isUndoingRedoing||
(e=a.data,c=c.model,null!==e&&c.Bj()&&(d=c.pa(d),void 0!==d&&c.Qv(e,d))),this.containingGroup=a.containingGroup);Ql(this);this.g("labeledLink",b,a)}}},port:{configurable:!0,get:function(){return this.Xt("")}},ports:{configurable:!0,get:function(){null===this.yc&&kp(this);return this.yc.iteratorValues}},isTreeExpanded:{configurable:!0,get:function(){return 0!==(this.T&1)},set:function(a){var b=0!==(this.T&1);if(b!==a){F&&A(a,"boolean",U,"isTreeExpanded");this.T^=
1;var c=this.diagram;this.g("isTreeExpanded",b,a);b=this.treeExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.ba,c.ba=!0);b(this);null!==c&&(c.ba=d)}null!==c&&c.undoManager.isUndoingRedoing?this.Ub(a):a?this.expandTree():this.collapseTree()}}},wasTreeExpanded:{configurable:!0,get:function(){return 0!==(this.T&2)},set:function(a){var b=0!==(this.T&2);b!==a&&(F&&A(a,"boolean",U,"wasTreeExpanded"),this.T^=2,this.g("wasTreeExpanded",b,a))}},treeExpandedChanged:{configurable:!0,
get:function(){return this.yq},set:function(a){var b=this.yq;b!==a&&(null!==a&&A(a,"function",U,"treeExpandedChanged"),this.yq=a,this.g("treeExpandedChanged",b,a))}},isTreeLeaf:{configurable:!0,get:function(){return 0!==(this.T&4)},set:function(a){var b=0!==(this.T&4);b!==a&&(F&&A(a,"boolean",U,"isTreeLeaf"),this.T^=4,this.g("isTreeLeaf",b,a))}}});U.prototype.expandTree=U.prototype.expandTree;U.prototype.collapseTree=U.prototype.collapseTree;U.prototype.findTreeParts=U.prototype.wA;
U.prototype.findTreeChildrenNodes=U.prototype.jw;U.prototype.findTreeChildrenLinks=U.prototype.Sq;U.prototype.findTreeLevel=U.prototype.uA;U.prototype.findTreeParentChain=U.prototype.vA;U.prototype.findTreeParentNode=U.prototype.Rg;U.prototype.findTreeParentLink=U.prototype.uj;U.prototype.findCommonTreeParent=U.prototype.iA;U.prototype.findTreeRoot=U.prototype.xA;U.prototype.isInTreeOf=U.prototype.PA;U.prototype.findPort=U.prototype.Xt;U.prototype.findLinksTo=U.prototype.mA;
U.prototype.findLinksBetween=U.prototype.lA;U.prototype.findNodesInto=U.prototype.gw;U.prototype.findNodesOutOf=U.prototype.hw;U.prototype.findNodesConnected=U.prototype.fw;U.prototype.findLinksInto=U.prototype.Hd;U.prototype.findLinksOutOf=U.prototype.Qq;U.prototype.findExternalTreeLinksConnected=U.prototype.Cy;U.prototype.invalidateConnectedLinks=U.prototype.sd;U.prototype.invalidateLinkBundle=U.prototype.NA;
var pp=new E(U,"SpreadingNone",10),cp=new E(U,"SpreadingEvenly",11),qp=new E(U,"SpreadingPacked",12);U.className="Node";U.SpreadingNone=pp;U.SpreadingEvenly=cp;U.SpreadingPacked=qp;function Hf(a){U.call(this,a);this.T|=4608;this.ep=new I;this.Zl=new I;this.Ra=this.pq=this.Ui=this.fp=this.cp=null;this.qc=new Mi;this.qc.group=this}la(Hf,U);
Hf.prototype.cloneProtected=function(a){U.prototype.cloneProtected.call(this,a);this.T=this.T&-32769;a.cp=this.cp;a.fp=this.fp;a.Ui=this.Ui;a.pq=this.pq;var b=a.Gm(function(a){return a instanceof Kg});b instanceof Kg?a.Ra=b:a.Ra=null;null!==this.qc?(a.qc=this.qc.copy(),a.qc.group=a):(null!==a.qc&&(a.qc.group=null),a.qc=null)};t=Hf.prototype;
t.Kf=function(a){U.prototype.Kf.call(this,a);var b=a.Gk();for(a=a.memberParts;a.next();){var c=a.value;c.v();c.D(8);c.xk();if(c instanceof U)c.sd(b);else if(c instanceof R)for(c=c.labelNodes;c.next();)c.value.sd(b)}};
t.Uk=function(a,b,c,d,e,f,g){if(a===Je&&"elements"===b)if(e instanceof Kg)null===this.Ra?this.Ra=e:this.Ra!==e&&v("Cannot insert a second Placeholder into the visual tree of a Group.");else{if(e instanceof V){var h=e.Gm(function(a){return a instanceof Kg});h instanceof Kg&&(null===this.Ra?this.Ra=h:this.Ra!==h&&v("Cannot insert a second Placeholder into the visual tree of a Group."))}}else a===Ke&&"elements"===b&&null!==this.Ra&&(d===this.Ra?this.Ra=null:d instanceof V&&this.Ra.Sg(d)&&(this.Ra=null));
U.prototype.Uk.call(this,a,b,c,d,e,f,g)};t.Th=function(a,b,c,d){this.pf=this.Ra;U.prototype.Th.call(this,a,b,c,d)};t.Ya=function(){var a=this;a.isSubGraphExpanded&&this.memberParts.each(function(b){!a.computesBoundsIncludingLinks&&b instanceof R||b.Ya()});U.prototype.Ya.call(this)};
t.Cj=function(){if(!U.prototype.Cj.call(this))return!1;for(var a=this.memberParts;a.next();){var b=a.value;if(b instanceof U){if(b.isVisible()&&Gj(b))return!1}else if(b instanceof R&&b.isVisible()&&Gj(b)&&b.fromNode!==this&&b.toNode!==this)return!1}return!0};
function Wo(a,b){if(a.ep.add(b)){b instanceof Hf&&a.Zl.add(b);var c=a.memberAdded;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.ba,e.ba=!0);c(a,b);null!==e&&(e.ba=d)}a.isVisible()&&a.isSubGraphExpanded||b.Ub(!1)}b instanceof R&&!a.computesBoundsIncludingLinks||(b=a.Ra,null===b&&(b=a),b.v())}
function Xo(a,b){if(a.ep.remove(b)){b instanceof Hf&&a.Zl.remove(b);var c=a.memberRemoved;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.ba,e.ba=!0);c(a,b);null!==e&&(e.ba=d)}a.isVisible()&&a.isSubGraphExpanded||b.Ub(!0)}b instanceof R&&!a.computesBoundsIncludingLinks||(b=a.Ra,null===b&&(b=a),b.v())}t.Dk=function(){if(0<this.ep.count){var a=this.diagram;if(null!==a)for(var b=this.ep.copy().iterator;b.next();)a.remove(b.value)}U.prototype.Dk.call(this)};
Hf.prototype.canAddMembers=function(a){var b=this.diagram;if(null===b)return!1;b=b.commandHandler;for(a=hl(a).iterator;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};Hf.prototype.addMembers=function(a,b){var c=this.diagram;if(null===c)return!1;c=c.commandHandler;var d=!0;for(a=hl(a).iterator;a.next();){var e=a.value;!b||c.isValidMember(this,e)?e.containingGroup=this:d=!1}return d};
Hf.prototype.canUngroup=function(){if(!this.ungroupable)return!1;var a=this.layer;if(null!==a&&!a.allowUngroup)return!1;a=a.diagram;return null===a||a.allowUngroup?!0:!1};t=Hf.prototype;
t.sd=function(a){void 0===a&&(a=null);var b=0!==(this.T&65536);U.prototype.sd.call(this,a);if(!b)for(0!==(this.T&65536)!==!0&&(this.T=this.T^65536),b=this.ew();b.next();){var c=b.value;if(null===a||!a.contains(c)){var d=c.fromNode;null!==d&&d!==this&&d.Jd(this)&&!d.isVisible()?(fp(d,c.fromPort),fp(d,c.toPort),c.Za()):(d=c.toNode,null!==d&&d!==this&&d.Jd(this)&&!d.isVisible()&&(fp(d,c.fromPort),fp(d,c.toPort),c.Za()))}}};
t.ew=function(){var a=this.Gk();a.add(this);for(var b=new I,c=a.iterator;c.next();){var d=c.value;if(d instanceof U)for(d=d.linksConnected;d.next();){var e=d.value;a.contains(e)||b.add(e)}}return b.iterator};t.kA=function(){var a=this.Gk();a.add(this);for(var b=new I,c=a.iterator;c.next();){var d=c.value;if(d instanceof U)for(d=d.linksConnected;d.next();){var e=d.value,f=e.fromNode;null===f||a.contains(f)&&f!==this||b.add(f);e=e.toNode;null===e||a.contains(e)&&e!==this||b.add(e)}}return b.iterator};
t.jA=function(){function a(b,d){null!==b&&(d.add(b),a(b.containingGroup,d))}var b=new I;a(this,b);return b};t.Gk=function(){var a=new I;fl(a,this,!0,0,!0);a.remove(this);return a};t.Ub=function(a){U.prototype.Ub.call(this,a);for(var b=this.memberParts;b.next();)b.value.Ub(a)};Hf.prototype.collapseSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Ue){a.Ue=!0;var b=this.Gk();rp(this,b,a,this);a.Ue=!1}};
function rp(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Ub(!1);f instanceof Hf&&f.isSubGraphExpanded&&(f.wasSubGraphExpanded=f.isSubGraphExpanded,rp(f,b,c,d));if(f instanceof U)f.sd(b),c.tk(f,d);else if(f instanceof R)for(f=f.labelNodes;f.next();)f.value.sd(b)}a.isSubGraphExpanded=!1}Hf.prototype.expandSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Ue){a.Ue=!0;var b=this.Gk();sp(this,b,a,this);a.Ue=!1}};
function sp(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Ub(!0);f instanceof Hf&&f.wasSubGraphExpanded&&(f.wasSubGraphExpanded=!1,sp(f,b,c,d));if(f instanceof U)f.sd(b),c.vk(f,d);else if(f instanceof R)for(f=f.labelNodes;f.next();)f.value.sd(b)}a.isSubGraphExpanded=!0}
Hf.prototype.move=function(a,b){void 0===b&&(b=!1);var c=b?this.location:this.position,d=c.x;c=c.y;var e=a.x,f=a.y;if(!(d===e||isNaN(d)&&isNaN(e))||!(c===f||isNaN(c)&&isNaN(f))){d=e-(isNaN(d)?0:d);c=f-(isNaN(c)?0:c);f=J.alloc();U.prototype.move.call(this,a,b);a=new I;for(b=this.Gk().iterator;b.next();)if(e=b.value,e instanceof R&&(e.suspendsRouting&&a.add(e),e.kd||e.fromNode!==this&&e.toNode!==this))e.suspendsRouting=!0;for(b.reset();b.next();)if(e=b.value,!(e.$h()||e instanceof U&&e.isLinkLabel)){var g=
e.position,h=e.location;g.o()?(f.x=g.x+d,f.y=g.y+c,e.position=f):h.o()&&(f.x=h.x+d,f.y=h.y+c,e.location=f)}for(b.reset();b.next();)if(e=b.value,e instanceof R&&(e.suspendsRouting=a.contains(e),e.kd||e.fromNode!==this&&e.toNode!==this))g=e.position,f.x=g.x+d,f.y=g.y+c,f.o()?e.move(f):e.Za(),dk(e)&&e.Za();J.free(f)}};
ma.Object.defineProperties(Hf.prototype,{placeholder:{configurable:!0,get:function(){return this.Ra}},computesBoundsAfterDrag:{configurable:!0,get:function(){return 0!==(this.T&2048)},set:function(a){var b=0!==(this.T&2048);b!==a&&(A(a,"boolean",Hf,"computesBoundsAfterDrag"),this.T^=2048,this.g("computesBoundsAfterDrag",b,a))}},computesBoundsIncludingLinks:{configurable:!0,get:function(){return 0!==(this.T&4096)},set:function(a){A(a,"boolean",Hf,"computesBoundsIncludingLinks");
var b=0!==(this.T&4096);b!==a&&(this.T^=4096,this.g("computesBoundsIncludingLinks",b,a))}},computesBoundsIncludingLocation:{configurable:!0,get:function(){return 0!==(this.T&8192)},set:function(a){A(a,"boolean",Hf,"computesBoundsIncludingLocation");var b=0!==(this.T&8192);b!==a&&(this.T^=8192,this.g("computesBoundsIncludingLocation",b,a))}},handlesDragDropForMembers:{configurable:!0,get:function(){return 0!==(this.T&16384)},set:function(a){A(a,"boolean",Hf,"handlesDragDropForMembers");
var b=0!==(this.T&16384);b!==a&&(this.T^=16384,this.g("handlesDragDropForMembers",b,a))}},memberParts:{configurable:!0,get:function(){return this.ep.iterator}},layout:{configurable:!0,get:function(){return this.qc},set:function(a){var b=this.qc;if(b!==a){null!==a&&x(a,Mi,Hf,"layout");null!==b&&(b.diagram=null,b.group=null);this.qc=a;var c=this.diagram;null!==a&&(a.diagram=c,a.group=this);null!==c&&(c.Zg=!0);this.g("layout",b,a);null!==c&&c.Jb()}}},memberAdded:{configurable:!0,
enumerable:!0,get:function(){return this.cp},set:function(a){var b=this.cp;b!==a&&(null!==a&&A(a,"function",Hf,"memberAdded"),this.cp=a,this.g("memberAdded",b,a))}},memberRemoved:{configurable:!0,get:function(){return this.fp},set:function(a){var b=this.fp;b!==a&&(null!==a&&A(a,"function",Hf,"memberRemoved"),this.fp=a,this.g("memberRemoved",b,a))}},memberValidation:{configurable:!0,get:function(){return this.Ui},set:function(a){var b=this.Ui;b!==a&&(null!==a&&A(a,"function",
Hf,"memberValidation"),this.Ui=a,this.g("memberValidation",b,a))}},ungroupable:{configurable:!0,get:function(){return 0!==(this.T&256)},set:function(a){var b=0!==(this.T&256);b!==a&&(A(a,"boolean",Hf,"ungroupable"),this.T^=256,this.g("ungroupable",b,a))}},isSubGraphExpanded:{configurable:!0,get:function(){return 0!==(this.T&512)},set:function(a){var b=0!==(this.T&512);if(b!==a){A(a,"boolean",Hf,"isSubGraphExpanded");this.T^=512;var c=this.diagram;this.g("isSubGraphExpanded",
b,a);b=this.subGraphExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.ba,c.ba=!0);b(this);null!==c&&(c.ba=d)}null!==c&&c.undoManager.isUndoingRedoing?(null!==this.Ra&&this.Ra.v(),this.memberParts.each(function(a){a.updateAdornments()})):a?this.expandSubGraph():this.collapseSubGraph()}}},wasSubGraphExpanded:{configurable:!0,get:function(){return 0!==(this.T&1024)},set:function(a){var b=0!==(this.T&1024);b!==a&&(A(a,"boolean",Hf,"wasSubGraphExpanded"),this.T^=1024,this.g("wasSubGraphExpanded",
b,a))}},subGraphExpandedChanged:{configurable:!0,get:function(){return this.pq},set:function(a){var b=this.pq;b!==a&&(null!==a&&A(a,"function",Hf,"subGraphExpandedChanged"),this.pq=a,this.g("subGraphExpandedChanged",b,a))}},bi:{configurable:!0,get:function(){return 0!==(this.T&32768)},set:function(a){0!==(this.T&32768)!==a&&(this.T^=32768)}}});Hf.prototype.expandSubGraph=Hf.prototype.expandSubGraph;Hf.prototype.collapseSubGraph=Hf.prototype.collapseSubGraph;
Hf.prototype.findSubGraphParts=Hf.prototype.Gk;Hf.prototype.findContainingGroupChain=Hf.prototype.jA;Hf.prototype.findExternalNodesConnected=Hf.prototype.kA;Hf.prototype.findExternalLinksConnected=Hf.prototype.ew;Hf.prototype.ensureBounds=Hf.prototype.Ya;Hf.className="Group";function Kg(){N.call(this);this.mb=Ec;this.Wp=new L(NaN,NaN,NaN,NaN)}la(Kg,N);Kg.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.mb=this.mb.J();a.Wp=this.Wp.copy()};
Kg.prototype.Vh=function(a){if(null===this.background&&null===this.areaBackground)return!1;var b=this.naturalBounds;return rc(0,0,b.width,b.height,a.x,a.y)};
Kg.prototype.Rm=function(){var a=this.part;null!==a&&(a instanceof Hf||a instanceof Te)||v("Placeholder is not inside a Group or Adornment.");if(a instanceof Hf){var b=this.computeBorder(this.Wp),c=this.minSize,d=this.vc;gc(d,(isFinite(c.width)?Math.max(c.width,b.width):b.width)||0,(isFinite(c.height)?Math.max(c.height,b.height):b.height)||0);vl(this,0,0,d.width,d.height);d=a.memberParts;for(c=!1;d.next();)if(d.value.isVisible()){c=!0;break}d=a.diagram;!c||null===d||d.animationManager.sw(a)||isNaN(b.x)||
isNaN(b.y)||(c=J.alloc(),c.Ej(b,a.locationSpot),c.A(a.location)||(a.location=new J(c.x,c.y)),J.free(c))}else{b=this.vc;c=this.mb;d=c.left+c.right;var e=c.top+c.bottom,f=a.adornedObject;a.angle=f.wj();var g=0;f instanceof Yf&&(g=f.strokeWidth);var h=f.Mf(),k=f.naturalBounds,l=(k.width+g)*h;g=(k.height+g)*h;a.type!==V.Link&&(f=f.ma("Selection"===a.category?Hc:a.locationSpot,J.alloc()),a.location=f,J.free(f));isNaN(l)||isNaN(g)?(a=a.adornedObject,l=a.ma(Hc,J.alloc()),f=L.allocAt(l.x,l.y,0,0),f.Ze(a.ma(Sc,
l)),f.Ze(a.ma(Jc,l)),f.Ze(a.ma(Oc,l)),gc(b,f.width+d||0,f.height+e||0),vl(this,-c.left,-c.top,b.width,b.height),J.free(l),L.free(f)):(gc(b,l+d||0,g+e||0),vl(this,-c.left,-c.top,b.width,b.height))}};Kg.prototype.Th=function(a,b,c,d){this.actualBounds.h(a,b,c,d)};
Kg.prototype.computeBorder=function(a){var b=this.part,c=b.diagram;if(null!==c&&b instanceof Hf&&!b.layer.isTemporary&&b.computesBoundsAfterDrag&&this.Wp.o()){var d=c.toolManager.findTool("Dragging");if(d===c.currentTool&&(c=d.computeBorder(b,this.Wp,a),null!==c))return c}c=L.alloc();d=this.computeMemberBounds(c);var e=this.mb;b instanceof Hf&&!b.isSubGraphExpanded?a.h(d.x-e.left,d.y-e.top,0,0):a.h(d.x-e.left,d.y-e.top,Math.max(d.width+e.left+e.right,0),Math.max(d.height+e.top+e.bottom,0));L.free(c);
b instanceof Hf&&b.computesBoundsIncludingLocation&&b.location.o()&&a.Ze(b.location);return a};
Kg.prototype.computeMemberBounds=function(a){if(!(this.part instanceof Hf))return a.h(0,0,0,0),a;for(var b=this.part,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=b.memberParts;g.next();){var h=g.value;if(h.isVisible()){if(h instanceof R){if(!b.computesBoundsIncludingLinks)continue;if(Fj(h))continue;if(h.fromNode===b||h.toNode===b)continue}h=h.actualBounds;h.left<c&&(c=h.left);h.top<d&&(d=h.top);h.right>e&&(e=h.right);h.bottom>f&&(f=h.bottom)}}isFinite(c)&&isFinite(d)?a.h(c,d,e-c,f-d):(b=b.location,
a.h(b.x,b.y,0,0));return a};ma.Object.defineProperties(Kg.prototype,{padding:{configurable:!0,get:function(){return this.mb},set:function(a){"number"===typeof a?a=new lc(a):x(a,lc,Kg,"padding");var b=this.mb;b.A(a)||(this.mb=a=a.J(),this.g("padding",b,a),this.v())}}});Kg.className="Placeholder";
function R(){S.call(this,V.Link);this.Ka=8;this.gf=null;this.hf="";this.Df=this.so=null;this.Ef="";this.xq=null;this.cl=og;this.Tn=0;this.Vn=og;this.Wn=NaN;this.lk=tp;this.kq=.5;this.od=null;this.Fb=(new H).freeze();this.Cg=this.Lc=null;this.dm=new L;this.ua=new Fd;this.L=this.w=this.Xf=this.fg=null;this.l=[];this.Iv=new J;this.qs=this.Zx=this.Yx=null;this.bv=NaN;this.S=null}la(R,S);
R.prototype.cloneProtected=function(a){S.prototype.cloneProtected.call(this,a);a.Ka=this.Ka&-113;a.hf=this.hf;a.so=this.so;a.Ef=this.Ef;a.xq=this.xq;a.cl=this.cl;a.Tn=this.Tn;a.Vn=this.Vn;a.Wn=this.Wn;a.lk=this.lk;a.kq=this.kq;null!==this.S&&(a.S=this.S.copy())};t=R.prototype;t.Kf=function(a){S.prototype.Kf.call(this,a);this.hf=a.hf;this.Ef=a.Ef;a.Lc=null;a.Za();a.Xf=this.Xf;var b=a.fromPort;null!==b&&fp(a.fromNode,b);b=a.toPort;null!==b&&fp(a.toNode,b)};
t.nb=function(a){a.classType===R?2===(a.value&2)?this.routing=a:a===rg||a===ng||a===mg?this.curve=a:a===up||a===vp||a===wp?this.adjusting=a:a!==tp&&a!==og&&v("Unknown Link enum value for a Link property: "+a):S.prototype.nb.call(this,a)};t.Pc=function(){null===this.S&&(this.S=new rl)};t.Cj=function(){var a=this.fromNode;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(Gj(a)||Hj(a))return!1}a=this.toNode;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),Gj(a)||Hj(a))?!1:!0};t.Rw=function(){return!1};
t.yu=function(){};t.bc=function(){return!1};R.prototype.computeAngle=function(a,b,c){return R.computeAngle(b,c)};R.computeAngle=function(a,b){switch(a){default:case og:a=0;break;case jn:a=b;break;case bn:a=b+90;break;case dn:a=b-90;break;case xp:a=b+180;break;case kn:a=K.gr(b);90<a&&270>a&&(a-=180);break;case cn:a=K.gr(b+90);90<a&&270>a&&(a-=180);break;case en:a=K.gr(b-90);90<a&&270>a&&(a-=180);break;case fn:a=K.gr(b);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return K.gr(a)};
function bp(a){var b=a.fromNode,c=a.toNode,d=null;null!==b?d=null!==c?b.By(c):b.containingGroup:null!==c?d=c.containingGroup:d=null;b=d;c=a.yi;if(c!==b){null!==c&&Xo(c,a);a.yi=b;null!==b&&Wo(b,a);var e=a.containingGroupChanged;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.ba,g.ba=!0);e(a,c,b);null!==g&&(g.ba=f)}!a.kd||a.Yx!==c&&a.Zx!==c||a.Za()}if(a.isLabeledLink)for(a=a.labelNodes;a.next();)a.value.containingGroup=d}t=R.prototype;
t.Zh=function(){var a=this.containingGroup;null!==a&&this.fromNode!==a&&this.toNode!==a&&a.computesBoundsIncludingLinks&&S.prototype.Zh.call(this)};t.Vq=function(a){F&&x(a,U,R,"getOtherNode:node");var b=this.fromNode;return a===b?this.toNode:b};t.CA=function(a){F&&x(a,N,R,"getOtherPort:port");var b=this.fromPort;return a===b?this.toPort:b};function jp(a,b){null===a.od&&(a.od=new I);a.od.add(b);a.v()}
t.Xq=function(a){S.prototype.Xq.call(this,a);yp(this)&&this.$q(this.actualBounds);if(!a){a=this.gf;var b=null;null!==a&&(b=this.fromPort,hp(a,this,b));var c=this.Df;if(null!==c){var d=this.toPort;c===a&&d===b||hp(c,this,d)}zp(this)}};t.Yq=function(a){S.prototype.Yq.call(this,a);yp(this)&&this.$q(this.actualBounds);if(!a){a=this.gf;var b=null;null!==a&&(b=this.fromPort,ip(a,this,b));var c=this.Df;if(null!==c){var d=this.toPort;c===a&&d===b||ip(c,this,d)}Ap(this)}};
t.Dk=function(){this.kd=!0;if(null!==this.od){var a=this.diagram;if(null!==a)for(var b=this.od.copy().iterator;b.next();)a.remove(b.value)}null!==this.data&&(a=this.diagram,null!==a&&a.partManager.removeDataForLink(this))};R.prototype.updateRelationshipsFromData=function(){if(null!==this.data){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)}};
R.prototype.move=function(a,b){var c=b?this.location:this.position,d=c.x;isNaN(d)&&(d=0);var e=c.y;isNaN(e)&&(e=0);d=a.x-d;e=a.y-e;!0===b?S.prototype.move.call(this,a,!1):(a=J.allocAt(c.x+d,c.y+e),S.prototype.move.call(this,a,!1),J.free(a));Cf(this,d,e);for(a=this.labelNodes;a.next();)b=a.value,c=b.position,b.moveTo(c.x+d,c.y+e)};
R.prototype.canRelinkFrom=function(){if(!this.relinkableFrom)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};R.prototype.canRelinkTo=function(){if(!this.relinkableTo)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};
R.prototype.computeMidPoint=function(a){var b=this.pointsCount;if(0===b)return a.assign(Vb),a;if(1===b)return a.assign(this.i(0)),a;if(2===b){var c=this.i(0),d=this.i(1);a.h((c.x+d.x)/2,(c.y+d.y)/2);return a}if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===rg))return this.ua.kw(.5,a),a.add(this.i(0)),c=this.ua.figures.first(),a.offset(-c.startX,-c.startY),a;if(this.computeCurve()===rg){if(3===b)return this.i(1);d=(b-1)/3|0;c=3*(d/2|0);if(1===d%2){d=this.i(c);var e=this.i(c+1),
f=this.i(c+2);c=this.i(c+3);K.Kz(d.x,d.y,e.x,e.y,f.x,f.y,c.x,c.y,a)}else a.assign(this.i(c));return a}var g=this.flattenedLengths;c=this.flattenedTotalLength;for(e=f=d=0;d<c/2&&f<b;){e=g[f];if(d+e>c/2)break;d+=e;f++}b=this.i(f);f=this.i(f+1);1>Math.abs(b.x-f.x)?b.y>f.y?a.h(b.x,b.y-(c/2-d)):a.h(b.x,b.y+(c/2-d)):1>Math.abs(b.y-f.y)?b.x>f.x?a.h(b.x-(c/2-d),b.y):a.h(b.x+(c/2-d),b.y):(c=(c/2-d)/e,a.h(b.x+c*(f.x-b.x),b.y+c*(f.y-b.y)));return a};
R.prototype.computeMidAngle=function(){var a=this.pointsCount;if(2>a)return NaN;if(2===a)return this.i(0).Xa(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===rg))return this.ua.Hy(.5);if(this.computeCurve()===rg&&4<=a){var b=(a-1)/3|0,c=3*(b/2|0);if(1===b%2){c=Math.floor(c);a=this.i(c);b=this.i(c+1);var d=this.i(c+2);c=this.i(c+3);return K.Jz(a.x,a.y,b.x,b.y,d.x,d.y,c.x,c.y)}if(0<c&&c+1<a)return this.i(c-1).Xa(this.i(c+1))}b=this.flattenedLengths;d=this.flattenedTotalLength;
var e=0;c=0;for(var f;e<d/2&&c<a;){f=b[c];if(e+f>d/2)break;e+=f;c++}b=this.i(c);d=this.i(c+1);if(1>Math.abs(b.x-d.x)&&1>Math.abs(b.y-d.y)){if(0<c&&c+2<a)return this.i(c-1).Xa(this.i(c+2))}else{if(1>Math.abs(b.x-d.x))return b.y>d.y?270:90;if(1>Math.abs(b.y-d.y))return b.x>d.x?180:0}return b.Xa(d)};t=R.prototype;t.i=function(a){return this.Fb.j[a]};
t.ud=function(a,b){F&&(x(b,J,R,"setPoint"),b.o()||v("Link.setPoint called with a Point that does not have real numbers: "+b.toString()));F&&null===this.Lc&&v("Call Link.startRoute before modifying the points of the route.");this.Fb.td(a,b)};t.N=function(a,b,c){F&&(C(b,R,"setPointAt:x"),C(c,R,"setPointAt:y"));F&&null===this.Lc&&v("Call Link.startRoute before modifying the points of the route.");this.Fb.td(a,new J(b,c))};
t.LA=function(a,b){F&&(x(b,J,R,"insertPoint"),b.o()||v("Link.insertPoint called with a Point that does not have real numbers: "+b.toString()));F&&null===this.Lc&&v("Call Link.startRoute before modifying the points of the route.");this.Fb.Ab(a,b)};t.m=function(a,b,c){F&&(C(b,R,"insertPointAt:x"),C(c,R,"insertPointAt:y"));F&&null===this.Lc&&v("Call Link.startRoute before modifying the points of the route.");this.Fb.Ab(a,new J(b,c))};
t.Oe=function(a){F&&(x(a,J,R,"addPoint"),a.o()||v("Link.addPoint called with a Point that does not have real numbers: "+a.toString()));F&&null===this.Lc&&v("Call Link.startRoute before modifying the points of the route.");this.Fb.add(a)};t.Hf=function(a,b){F&&(C(a,R,"insertPointAt:x"),C(b,R,"insertPointAt:y"));F&&null===this.Lc&&v("Call Link.startRoute before modifying the points of the route.");this.Fb.add(new J(a,b))};
t.Gw=function(a){F&&null===this.Lc&&v("Call Link.startRoute before modifying the points of the route.");this.Fb.ib(a)};t.yk=function(){F&&null===this.Lc&&v("Call Link.startRoute before modifying the points of the route.");this.Fb.clear()};
function Cf(a,b,c){if(0!==b||0!==c){for(var d=a.kd,e=new H,f=a.Fb.iterator;f.next();){var g=f.value;e.add((new J(g.x+b,g.y+c)).freeze())}e.freeze();f=a.Fb;a.Fb=e;g=a.diagram;isNaN(b)||isNaN(c)||null!==g&&g.animationManager.xc?a.v():(a.pg.h(a.pg.x+b,a.pg.y+c),a.ra.h(a.ra.x+b,a.ra.y+c),Ql(a));d&&Bp(a);null!==g&&g.animationManager.xc&&(a.Cg=e);a.g("points",f,e)}}t.di=function(){null===this.Lc&&(this.Lc=this.Fb,this.Fb=this.Fb.copy())};
t.Jf=function(){if(null!==this.Lc){for(var a=this.Lc,b=this.Fb,c=Infinity,d=Infinity,e=a.j,f=e.length,g=0;g<f;g++){var h=e[g];c=Math.min(h.x,c);d=Math.min(h.y,d)}h=g=Infinity;for(var k=b.j,l=k.length,m=0;m<l;m++){var n=k[m];g=Math.min(n.x,g);h=Math.min(n.y,h);n.freeze()}b.freeze();if(l===f)for(f=0;f<l;f++){if(m=e[f],n=k[f],m.x-c!==n.x-g||m.y-d!==n.y-h){this.ic();break}}else this.ic();this.Lc=null;c=this.diagram;null!==c&&c.animationManager.xc&&(this.Cg=b);Bp(this);this.g("points",a,b)}};
t.Lw=function(){null!==this.Lc&&(this.Fb=this.Lc,this.Lc=null)};function Bp(a){0===a.Fb.count?a.kd=!1:(a.kd=!0,a.qs=null,a.bv=NaN,a.defaultFromPoint=a.i(0),a.defaultToPoint=a.i(a.pointsCount-1),Cp(a,!1))}t.Za=function(){if(!this.suspendsRouting){var a=this.diagram;if(a){if(a.ju.contains(this)||a.undoManager.isUndoingRedoing)return;a=a.animationManager;if(a.isTicking&&!a.isAnimating)return;null!==this.Cg&&!a.isTicking&&a.isAnimating&&(this.Cg=null)}a=this.path;null!==a&&(this.kd=!1,this.v(),a.v())}};
t.Ij=function(){if(!this.kd&&!this.Pt){var a=!0;try{this.Pt=!0,this.di(),a=this.computePoints()}catch(b){this.Pt=!1,this.Lw()}finally{this.Pt=!1,a?this.Jf():this.Lw()}}};
R.prototype.computePoints=function(){var a=this.diagram;if(null===a)return!1;var b=this.fromNode,c=null;null===b?(a.Ch||(a.fm=new Yf,a.fm.desiredSize=Wb,a.fm.strokeWidth=0,a.Ch=new U,a.Ch.add(a.fm),a.Ch.Ya()),this.defaultFromPoint&&(a.Ch.position=a.Ch.location=this.defaultFromPoint,a.Ch.Ya(),b=a.Ch,c=a.fm)):c=this.fromPort;if(null!==c&&!b.isVisible()){var d=b.findVisibleNode();null!==d&&d!==b?(b=d,c=d.port):b=d}this.Yx=b;if(null===b||!b.location.o())return!1;for(;!(null===c||c.actualBounds.o()&&c.Rf());)c=
c.panel;if(null===c)return!1;var e=this.toNode,f=null;null===e?(a.Dh||(a.gm=new Yf,a.gm.desiredSize=Wb,a.gm.strokeWidth=0,a.Dh=new U,a.Dh.add(a.gm),a.Dh.Ya()),this.defaultToPoint&&(a.Dh.position=a.Dh.location=this.defaultToPoint,a.Dh.Ya(),e=a.Dh,f=a.gm)):f=this.toPort;null===f||e.isVisible()||(a=e.findVisibleNode(),null!==a&&a!==e?(e=a,f=a.port):e=a);this.Zx=e;if(null===e||!e.location.o())return!1;for(;!(null===f||f.actualBounds.o()&&f.Rf());)f=f.panel;if(null===f)return!1;var g=this.pointsCount;
d=this.computeSpot(!0,c);a=this.computeSpot(!1,f);var h=Dp(d),k=Dp(a),l=c===f&&null!==c,m=this.isOrthogonal,n=this.curve===rg;this.fg=l&&!m?n=!0:!1;var p=this.computeAdjusting()===og||l;if(!m&&!l&&h&&k){if(h=!1,!p&&3<=g&&(p=this.getLinkPoint(b,c,d,!0,!1,e,f),k=this.getLinkPoint(e,f,a,!1,!1,b,c),h=this.adjustPoints(0,p,g-1,k))&&(p=this.getLinkPoint(b,c,d,!0,!1,e,f),k=this.getLinkPoint(e,f,a,!1,!1,b,c),this.adjustPoints(0,p,g-1,k)),!h)if(this.yk(),n){g=this.getLinkPoint(b,c,d,!0,!1,e,f);p=this.getLinkPoint(e,
f,a,!1,!1,b,c);h=p.x-g.x;k=p.y-g.y;l=this.computeCurviness();n=m=0;var r=g.x+h/3,q=g.y+k/3,u=r,w=q;K.C(k,0)?w=0<h?w-l:w+l:(m=-h/k,n=Math.sqrt(l*l/(m*m+1)),0>l&&(n=-n),u=(0>k?-1:1)*n+r,w=m*(u-r)+q);r=g.x+2*h/3;q=g.y+2*k/3;var y=r,z=q;K.C(k,0)?z=0<h?z-l:z+l:(y=(0>k?-1:1)*n+r,z=m*(y-r)+q);this.yk();this.Oe(g);this.Hf(u,w);this.Hf(y,z);this.Oe(p);this.ud(0,this.getLinkPoint(b,c,d,!0,!1,e,f));this.ud(3,this.getLinkPoint(e,f,a,!1,!1,b,c))}else d=this.getLinkPoint(b,c,d,!0,!1,e,f),a=this.getLinkPoint(e,
f,a,!1,!1,b,c),this.hasCurviness()?(p=a.x-d.x,e=a.y-d.y,f=this.computeCurviness(),b=d.x+p/2,c=d.y+e/2,g=b,h=c,K.C(e,0)?h=0<p?h-f:h+f:(p=-p/e,g=Math.sqrt(f*f/(p*p+1)),0>f&&(g=-g),g=(0>e?-1:1)*g+b,h=p*(g-b)+c),this.Oe(d),this.Hf(g,h)):this.Oe(d),this.Oe(a)}else{n=this.isAvoiding;p&&(m&&n||l)&&this.yk();var B=l?this.computeCurviness():0;n=this.getLinkPoint(b,c,d,!0,m,e,f);r=u=q=0;if(m||!h||l)w=this.computeEndSegmentLength(b,c,d,!0),r=this.getLinkDirection(b,c,n,d,!0,m,e,f),l&&(h||d.A(a)||!m&&1===d.x+
a.x&&1===d.y+a.y)&&(r-=m?90:30,0>B&&(r-=180)),0>r?r+=360:360<=r&&(r-=360),l&&(w+=Math.abs(B)*(m?1:2)),0===r?q=w:90===r?u=w:180===r?q=-w:270===r?u=-w:(q=w*Math.cos(r*Math.PI/180),u=w*Math.sin(r*Math.PI/180)),d.Sb()&&l&&(w=c.ma(Mc,J.alloc()),y=J.allocAt(w.x+1E3*q,w.y+1E3*u),this.getLinkPointFromPoint(b,c,w,y,!0,n),J.free(w),J.free(y));w=this.getLinkPoint(e,f,a,!1,m,b,c);var D=z=y=0;if(m||!k||l){var G=this.computeEndSegmentLength(e,f,a,!1);D=this.getLinkDirection(e,f,w,a,!1,m,b,c);l&&(k||d.A(a)||!m&&
1===d.x+a.x&&1===d.y+a.y)&&(D+=m?0:30,0>B&&(D+=180));0>D?D+=360:360<=D&&(D-=360);l&&(G+=Math.abs(B)*(m?1:2));0===D?y=G:90===D?z=G:180===D?y=-G:270===D?z=-G:(y=G*Math.cos(D*Math.PI/180),z=G*Math.sin(D*Math.PI/180));a.Sb()&&l&&(a=f.ma(Mc,J.alloc()),d=J.allocAt(a.x+1E3*y,a.y+1E3*z),this.getLinkPointFromPoint(e,f,a,d,!1,w),J.free(a),J.free(d))}a=n;if(m||!h||l)a=new J(n.x+q,n.y+u);d=w;if(m||!k||l)d=new J(w.x+y,w.y+z);!p&&!m&&h&&3<g&&this.adjustPoints(0,n,g-2,d)?this.ud(g-1,w):!p&&!m&&k&&3<g&&this.adjustPoints(1,
a,g-1,w)?this.ud(0,n):!p&&(m?6<=g:4<g)&&this.adjustPoints(1,a,g-2,d)?(this.ud(0,n),this.ud(g-1,w)):(this.yk(),this.Oe(n),(m||!h||l)&&this.Oe(a),m&&this.addOrthoPoints(a,r,d,D,b,e),(m||!k||l)&&this.Oe(d),this.Oe(w))}return!0};function Ep(a,b){Math.abs(b.x-a.x)>Math.abs(b.y-a.y)?(b.x>=a.x?b.x=a.x+9E9:b.x=a.x-9E9,b.y=a.y):(b.y>=a.y?b.y=a.y+9E9:b.y=a.y-9E9,b.x=a.x);return b}
R.prototype.getLinkPointFromPoint=function(a,b,c,d,e,f){void 0===f&&(f=new J);if(null===a||null===b)return f.assign(c),f;a.isVisible()||(e=a.findVisibleNode(),null!==e&&e!==a&&(b=e.port));a=null;e=b.panel;null===e||e.le()||(e=e.panel);if(null===e){e=d.x;d=d.y;var g=c.x;c=c.y}else{a=e.Gd;e=1/(a.m11*a.m22-a.m12*a.m21);g=a.m22*e;var h=-a.m12*e,k=-a.m21*e,l=a.m11*e,m=e*(a.m21*a.dy-a.m22*a.dx),n=e*(a.m12*a.dx-a.m11*a.dy);e=d.x*g+d.y*k+m;d=d.x*h+d.y*l+n;g=c.x*g+c.y*k+m;c=c.x*h+c.y*l+n}b.Hk(e,d,g,c,f);null!==
a&&f.transform(a);return f};function Fp(a,b){var c=b.Hp;null===c&&(c=new Gp,c.port=b,c.node=b.part,b.Hp=c);return Hp(c,a)}
R.prototype.getLinkPoint=function(a,b,c,d,e,f,g,h){void 0===h&&(h=new J);if(c.cb()&&!Dp(c))return b.ma(c,h),h;if(c.Sc()){var k=Fp(this,b);if(null!==k){h.assign(k.dr);if(e&&this.routing===Ip){var l=Fp(this,g);if(null!==l&&k.Em<l.Em){k=J.alloc();l=J.alloc();var m=new L(b.ma(Hc,k),b.ma(Sc,l)),n=this.computeSpot(!d,g);a=this.getLinkPoint(f,g,n,!d,e,a,b,l);(c.Pf(Uc)||c.Pf(Vc))&&a.y>=m.y&&a.y<=m.y+m.height?h.y=a.y:(c.Pf(Tc)||c.Pf(Wc))&&a.x>=m.x&&a.x<=m.x+m.width&&(h.x=a.x);J.free(k);J.free(l)}}return h}}c=
b.ma(.5===c.x&&.5===c.y?c:Mc,J.alloc());this.pointsCount>(e?6:2)?(g=d?this.i(1):this.i(this.pointsCount-2),e&&(g=Ep(c,g.copy()))):(k=this.computeSpot(!d,g),f=J.alloc(),g=g.ma(.5===k.x&&.5===k.y?k:Mc,f),e&&(g=Ep(c,g)),J.free(f));this.getLinkPointFromPoint(a,b,c,g,d,h);J.free(c);return h};
R.prototype.getLinkDirection=function(a,b,c,d,e,f,g,h){a:if(d.cb())var k=d.x>d.y?d.x>1-d.y?0:d.x<1-d.y?270:315:d.x<d.y?d.x>1-d.y?90:d.x<1-d.y?180:135:.5>d.x?225:.5<d.x?45:0;else{if(d.Sc()&&(k=Fp(this,b),null!==k))switch(k.Gc){case 1:k=270;break a;case 2:k=180;break a;default:case 4:k=0;break a;case 8:k=90;break a}k=b.ma(Mc,J.alloc());this.pointsCount>(f?6:2)?(h=e?this.i(1):this.i(this.pointsCount-2),h=f?Ep(k,h.copy()):c):(c=J.alloc(),h=h.ma(Mc,c),J.free(c));c=Math.abs(h.x-k.x)>Math.abs(h.y-k.y)?h.x>=
k.x?0:180:h.y>=k.y?90:270;J.free(k);k=c}d.Sb()&&g.Jd(a)&&(k+=180,360<=k&&(k-=360));if(Dp(d))return k;a=b.wj();if(0===a)return k;45<=a&&135>a?k+=90:135<=a&&225>a?k+=180:225<=a&&315>a&&(k+=270);360<=k&&(k-=360);return k};R.prototype.computeEndSegmentLength=function(a,b,c,d){if(null!==b&&c.Sc()&&(a=Fp(this,b),null!==a))return a.cw;a=d?this.fromEndSegmentLength:this.toEndSegmentLength;null!==b&&isNaN(a)&&(a=d?b.fromEndSegmentLength:b.toEndSegmentLength);isNaN(a)&&(a=10);return a};
R.prototype.computeSpot=function(a,b){void 0===b&&(b=null);a?(a=b?b:this.fromPort,null===a?a=Mc:(b=this.fromSpot,b.Ib()&&(b=a.fromSpot),a=b===ld?Gc:b)):(a=b?b:this.toPort,null===a?a=Mc:(b=this.toSpot,b.Ib()&&(b=a.toSpot),a=b===ld?Gc:b));return a};function Dp(a){return a===Gc||.5===a.x&&.5===a.y}R.prototype.computeOtherPoint=function(a,b){if(this.computeAdjusting()!==og&&4<this.pointsCount)return this.computeMidPoint(new J);a=b.ma(Mc);b=b.Hp;b=null!==b?Hp(b,this):null;null!==b&&(a=b.dr);return a};
R.prototype.computeShortLength=function(a){if(a){a=this.fromShortLength;if(isNaN(a)){var b=this.fromPort;null!==b&&(a=b.fromShortLength)}return isNaN(a)?0:a}a=this.toShortLength;isNaN(a)&&(b=this.toPort,null!==b&&(a=b.toShortLength));return isNaN(a)?0:a};
R.prototype.Lf=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var g=f;void 0===f&&(g=Ib.alloc(),g.reset());g.multiply(this.transform);if(this.Uh(a,g))return vn(this,b,c,e),void 0===f&&Ib.free(g),!0;if(this.Rc(a,g)){var h=!1;if(!this.isAtomic)for(var k=this.$.j,l=k.length;l--;){var m=k[l];if(m.visible||m===this.locationObject){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=Ib.alloc();n.set(g);
if(m instanceof V)h=m.Lf(a,b,c,d,e,n);else if(this.path===m){if(m instanceof Yf)if(h=a,p=d,!1===m.pickable)h=!1;else if(n.multiply(m.transform),p)b:{var r=h,q=n;if(m.Uh(r,q))h=!0;else{if(void 0===q&&(q=m.transform,r.Qe(m.actualBounds))){h=!0;break b}h=r.left;p=r.right;var u=r.top;r=r.bottom;var w=J.alloc(),y=J.alloc(),z=J.alloc(),B=Ib.alloc();B.set(q);B.ww(m.transform);B.eu();y.x=p;y.y=u;y.transform(B);w.x=h;w.y=u;w.transform(B);q=!1;Xn(m,w,y,z)?q=!0:(w.x=p,w.y=r,w.transform(B),Xn(m,w,y,z)?q=!0:(y.x=
h,y.y=r,y.transform(B),Xn(m,w,y,z)?q=!0:(w.x=h,w.y=u,w.transform(B),Xn(m,w,y,z)&&(q=!0))));Ib.free(B);J.free(w);J.free(y);J.free(z);h=q}}else h=m.Uh(h,n)}else h=xl(m,a,d,n);h&&(p=m,null!==b&&(p=b(m)),p&&(null===c||c(p))&&e.add(p));Ib.free(n)}}}void 0===f&&Ib.free(g);return h||null!==this.background||null!==this.areaBackground}void 0===f&&Ib.free(g);return!1};
R.prototype.computeCurve=function(){if(null===this.fg){var a=this.fromPort,b=this.isOrthogonal;this.fg=null!==a&&a===this.toPort&&!b}return this.fg?rg:this.curve};R.prototype.computeCorner=function(){if(this.curve===rg)return 0;var a=this.corner;if(isNaN(a)||0>a)a=10;return a};
R.prototype.findMidLabel=function(){for(var a=this.path,b=this.$.j,c=b.length,d=0;d<c;d++){var e=b[d];if(e!==a&&!e.isPanelMain&&(-Infinity===e.segmentIndex||isNaN(e.segmentIndex)))return e}for(a=this.labelNodes;a.next();)if(b=a.value,-Infinity===b.segmentIndex||isNaN(b.segmentIndex))return b;return null};
R.prototype.computeSpacing=function(){if(!this.isVisible())return 0;var a=Jp;a=Math.max(a,this.computeThickness());var b=this.fromPort,c=this.toPort;if(null!==b&&null!==c){var d=this.findMidLabel();if(null!==d){var e=d.naturalBounds,f=d.margin,g=isNaN(e.width)?30:e.width*d.scale+f.left+f.right;e=isNaN(e.height)?14:e.height*d.scale+f.top+f.bottom;d=d.segmentOrientation;d===jn||d===kn||d===xp?a=Math.max(a,e):d===dn||d===en||d===bn||d===cn?a=Math.max(a,g):(b=b.ma(Mc).Xa(c.ma(Mc))/180*Math.PI,a=Math.max(a,
Math.abs(Math.sin(b)*g)+Math.abs(Math.cos(b)*e)+1));this.curve===rg&&(a*=1.333)}}return a};R.prototype.arrangeBundledLinks=function(a,b){if(b)for(b=0;b<a.length;b++){var c=a[b];c.computeAdjusting()===og&&c.Za()}};
R.prototype.computeCurviness=function(){var a=this.curviness;if(isNaN(a)){a=Kp;var b=this.Xf;if(null!==b){for(var c=La(),d=0,e=b.links,f=0;f<e.length;f++){var g=e[f].computeSpacing();c.push(g);d+=g}d=-d/2;for(f=0;f<e.length;f++){if(e[f]===this){a=d+c[f]/2;break}d+=c[f]}b.mu===this.fromNode&&(a=-a);Oa(c)}}return a};R.prototype.computeThickness=function(){if(!this.isVisible())return 0;var a=this.path;return null!==a?Math.max(a.strokeWidth,1):1};
R.prototype.hasCurviness=function(){return!isNaN(this.curviness)||null!==this.Xf};
R.prototype.adjustPoints=function(a,b,c,d){var e=this.computeAdjusting();if(this.isOrthogonal){if(e===vp)return!1;e===wp&&(e=up)}switch(e){case vp:var f=this.i(a),g=this.i(c);if(!f.Ta(b)||!g.Ta(d)){e=f.x;f=f.y;var h=g.x-e,k=g.y-f,l=Math.sqrt(h*h+k*k);if(!K.ca(l,0)){if(K.ca(h,0))var m=0>k?-Math.PI/2:Math.PI/2;else m=Math.atan(k/Math.abs(h)),0>h&&(m=Math.PI-m);g=b.x;var n=b.y;h=d.x-g;var p=d.y-n;k=Math.sqrt(h*h+p*p);K.ca(h,0)?p=0>p?-Math.PI/2:Math.PI/2:(p=Math.atan(p/Math.abs(h)),0>h&&(p=Math.PI-p));
l=k/l;m=p-m;this.ud(a,b);for(a+=1;a<c;a++)b=this.i(a),h=b.x-e,k=b.y-f,b=Math.sqrt(h*h+k*k),K.ca(b,0)||(K.ca(h,0)?k=0>k?-Math.PI/2:Math.PI/2:(k=Math.atan(k/Math.abs(h)),0>h&&(k=Math.PI-k)),h=k+m,b*=l,this.N(a,g+b*Math.cos(h),n+b*Math.sin(h)));this.ud(c,d)}}return!0;case wp:f=this.i(a);n=this.i(c);if(!f.Ta(b)||!n.Ta(d)){e=f.x;f=f.y;g=n.x;n=n.y;l=(g-e)*(g-e)+(n-f)*(n-f);h=b.x;m=b.y;k=d.x;p=d.y;var r=1;if(0!==k-h){var q=(p-m)/(k-h);r=Math.sqrt(1+1/(q*q))}else q=9E9;this.ud(a,b);for(a+=1;a<c;a++){b=this.i(a);
var u=b.x,w=b.y,y=.5;0!==l&&(y=((e-u)*(e-g)+(f-w)*(f-n))/l);var z=e+y*(g-e),B=f+y*(n-f);b=Math.sqrt((u-z)*(u-z)+(w-B)*(w-B));w<q*(u-z)+B&&(b=-b);0<q&&(b=-b);u=h+y*(k-h);y=m+y*(p-m);0!==q?(b=u+b/r,this.N(a,b,y-(b-u)/q)):this.N(a,u,y+b)}this.ud(c,d)}return!0;case up:a:{if(this.isOrthogonal&&(e=this.i(a),f=this.i(a+1),g=this.i(a+2),h=f.x,m=f.y,n=h,l=m,K.C(e.y,f.y)?K.C(f.x,g.x)?m=b.y:K.C(f.y,g.y)&&(h=b.x):K.C(e.x,f.x)&&(K.C(f.y,g.y)?h=b.x:K.C(f.x,g.x)&&(m=b.y)),this.N(a+1,h,m),e=this.i(c),f=this.i(c-
1),g=this.i(c-2),h=f.x,m=f.y,k=h,p=m,K.C(e.y,f.y)?K.C(f.x,g.x)?m=d.y:K.C(f.y,g.y)&&(h=d.x):K.C(e.x,f.x)&&(K.C(f.y,g.y)?h=d.x:K.C(f.x,g.x)&&(m=d.y)),this.N(c-1,h,m),dk(this))){this.N(a+1,n,l);this.N(c-1,k,p);c=!1;break a}this.ud(a,b);this.ud(c,d);c=!0}return c;default:return!1}};
R.prototype.addOrthoPoints=function(a,b,c,d,e,f){b=-45<=b&&45>b?0:45<=b&&135>b?90:135<=b&&225>b?180:270;d=-45<=d&&45>d?0:45<=d&&135>d?90:135<=d&&225>d?180:270;var g=e.actualBounds.copy(),h=f.actualBounds.copy();if(g.o()&&h.o()){g.Oc(Lp,Lp);h.Oc(Lp,Lp);g.Ze(a);h.Ze(c);if(0===b)if(c.x>a.x||270===d&&c.y<a.y&&h.right>a.x||90===d&&c.y>a.y&&h.right>a.x){var k=new J(c.x,a.y);var l=new J(c.x,(a.y+c.y)/2);180===d?(k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1),l.x=k.x,l.y=c.y):270===d&&c.y<a.y||90===
d&&c.y>a.y?(k.x=a.x<h.left?this.computeMidOrthoPosition(a.x,a.y,h.left,c.y,!1):a.x<h.right&&(270===d&&a.y<h.top||90===d&&a.y>h.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):h.right,l.x=k.x,l.y=c.y):0===d&&a.x<h.left&&a.y>h.top&&a.y<h.bottom&&(k.x=a.x,k.y=a.y<c.y?Math.min(c.y,h.top):Math.max(c.y,h.bottom),l.y=k.y)}else{k=new J(a.x,c.y);l=new J((a.x+c.x)/2,c.y);if(180===d||90===d&&c.y<g.top||270===d&&c.y>g.bottom)180===d&&(h.fa(a)||g.fa(c))?k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,
!0):c.y<a.y&&(180===d||90===d)?k.y=this.computeMidOrthoPosition(a.x,g.top,c.x,Math.max(c.y,h.bottom),!0):c.y>a.y&&(180===d||270===d)&&(k.y=this.computeMidOrthoPosition(a.x,g.bottom,c.x,Math.min(c.y,h.top),!0)),l.x=c.x,l.y=k.y;if(k.y>g.top&&k.y<g.bottom)if(c.x>=g.left&&c.x<=a.x||a.x<=h.right&&a.x>=c.x){if(90===d||270===d)k=new J(Math.max((a.x+c.x)/2,a.x),a.y),l=new J(k.x,c.y)}else k.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,0===d?g.top:Math.min(g.top,h.top)):Math.max(c.y,0===d?g.bottom:Math.max(g.bottom,
h.bottom)),l.x=c.x,l.y=k.y}else if(180===b)if(c.x<a.x||270===d&&c.y<a.y&&h.left<a.x||90===d&&c.y>a.y&&h.left<a.x)k=new J(c.x,a.y),l=new J(c.x,(a.y+c.y)/2),0===d?(k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1),l.x=k.x,l.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(k.x=a.x>h.right?this.computeMidOrthoPosition(a.x,a.y,h.right,c.y,!1):a.x>h.left&&(270===d&&a.y<h.top||90===d&&a.y>h.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):h.left,l.x=k.x,l.y=c.y):180===d&&a.x>h.right&&a.y>h.top&&a.y<
h.bottom&&(k.x=a.x,k.y=a.y<c.y?Math.min(c.y,h.top):Math.max(c.y,h.bottom),l.y=k.y);else{k=new J(a.x,c.y);l=new J((a.x+c.x)/2,c.y);if(0===d||90===d&&c.y<g.top||270===d&&c.y>g.bottom)0===d&&(h.fa(a)||g.fa(c))?k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.y<a.y&&(0===d||90===d)?k.y=this.computeMidOrthoPosition(a.x,g.top,c.x,Math.max(c.y,h.bottom),!0):c.y>a.y&&(0===d||270===d)&&(k.y=this.computeMidOrthoPosition(a.x,g.bottom,c.x,Math.min(c.y,h.top),!0)),l.x=c.x,l.y=k.y;if(k.y>g.top&&k.y<g.bottom)if(c.x<=
g.right&&c.x>=a.x||a.x>=h.left&&a.x<=c.x){if(90===d||270===d)k=new J(Math.min((a.x+c.x)/2,a.x),a.y),l=new J(k.x,c.y)}else k.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,180===d?g.top:Math.min(g.top,h.top)):Math.max(c.y,180===d?g.bottom:Math.max(g.bottom,h.bottom)),l.x=c.x,l.y=k.y}else if(90===b)if(c.y>a.y||180===d&&c.x<a.x&&h.bottom>a.y||0===d&&c.x>a.x&&h.bottom>a.y)k=new J(a.x,c.y),l=new J((a.x+c.x)/2,c.y),270===d?(k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),l.x=c.x,l.y=k.y):180===
d&&c.x<a.x||0===d&&c.x>a.x?(k.y=a.y<h.top?this.computeMidOrthoPosition(a.x,a.y,c.x,h.top,!0):a.y<h.bottom&&(180===d&&a.x<h.left||0===d&&a.x>h.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):h.bottom,l.x=c.x,l.y=k.y):90===d&&a.y<h.top&&a.x>h.left&&a.x<h.right&&(k.x=a.x<c.x?Math.min(c.x,h.left):Math.max(c.x,h.right),k.y=a.y,l.x=k.x);else{k=new J(c.x,a.y);l=new J(c.x,(a.y+c.y)/2);if(270===d||0===d&&c.x<g.left||180===d&&c.x>g.right)270===d&&(h.fa(a)||g.fa(c))?k.x=this.computeMidOrthoPosition(a.x,
a.y,c.x,c.y,!1):c.x<a.x&&(270===d||0===d)?k.x=this.computeMidOrthoPosition(g.left,a.y,Math.max(c.x,h.right),c.y,!1):c.x>a.x&&(270===d||180===d)&&(k.x=this.computeMidOrthoPosition(g.right,a.y,Math.min(c.x,h.left),c.y,!1)),l.x=k.x,l.y=c.y;if(k.x>g.left&&k.x<g.right)if(c.y>=g.top&&c.y<=a.y||a.y<=h.bottom&&a.y>=c.y){if(0===d||180===d)k=new J(a.x,Math.max((a.y+c.y)/2,a.y)),l=new J(c.x,k.y)}else k.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,90===d?g.left:Math.min(g.left,h.left)):Math.max(c.x,90===
d?g.right:Math.max(g.right,h.right)),l.x=k.x,l.y=c.y}else if(c.y<a.y||180===d&&c.x<a.x&&h.top<a.y||0===d&&c.x>a.x&&h.top<a.y)k=new J(a.x,c.y),l=new J((a.x+c.x)/2,c.y),90===d?(k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),l.x=c.x,l.y=k.y):180===d&&c.x<a.x||0===d&&c.x>=a.x?(k.y=a.y>h.bottom?this.computeMidOrthoPosition(a.x,a.y,c.x,h.bottom,!0):a.y>h.top&&(180===d&&a.x<h.left||0===d&&a.x>h.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):h.top,l.x=c.x,l.y=k.y):270===d&&a.y>h.bottom&&a.x>
h.left&&a.x<h.right&&(k.x=a.x<c.x?Math.min(c.x,h.left):Math.max(c.x,h.right),k.y=a.y,l.x=k.x);else{k=new J(c.x,a.y);l=new J(c.x,(a.y+c.y)/2);if(90===d||0===d&&c.x<g.left||180===d&&c.x>g.right)90===d&&(h.fa(a)||g.fa(c))?k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):c.x<a.x&&(90===d||0===d)?k.x=this.computeMidOrthoPosition(g.left,a.y,Math.max(c.x,h.right),c.y,!1):c.x>a.x&&(90===d||180===d)&&(k.x=this.computeMidOrthoPosition(g.right,a.y,Math.min(c.x,h.left),c.y,!1)),l.x=k.x,l.y=c.y;if(k.x>g.left&&
k.x<g.right)if(c.y<=g.bottom&&c.y>=a.y||a.y>=h.top&&a.y<=c.y){if(0===d||180===d)k=new J(a.x,Math.min((a.y+c.y)/2,a.y)),l=new J(c.x,k.y)}else k.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,270===d?g.left:Math.min(g.left,h.left)):Math.max(c.x,270===d?g.right:Math.max(g.right,h.right)),l.x=k.x,l.y=c.y}var m=k,n=l,p=c;if(this.isAvoiding){var r=this.diagram;if(null===r||!Fk(r)||g.fa(p)&&!f.Jd(e)||h.fa(a)&&!e.Jd(f)||e===f||this.layer.isTemporary)b=!1;else{var q=Gk(r,!0,this.containingGroup,null);
if(17!==this.segmentIndex&&q.Kk(Math.min(a.x,m.x),Math.min(a.y,m.y),Math.abs(a.x-m.x),Math.abs(a.y-m.y))&&q.Kk(Math.min(m.x,n.x),Math.min(m.y,n.y),Math.abs(m.x-n.x),Math.abs(m.y-n.y))&&q.Kk(Math.min(n.x,p.x),Math.min(n.y,p.y),Math.abs(n.x-p.x),Math.abs(n.y-p.y)))b=!1;else{e=a;f=p;var u=c=null;if(r.isVirtualized){r=q.bounds.copy();r.Oc(-q.Kq,-q.Jq);var w=J.alloc();Kk(q,a.x,a.y)||(K.hd(r.x,r.y,r.x+r.width,r.y+r.height,a.x,a.y,m.x,m.y,w)?(c=a=w.copy(),b=w.Xa(m)):K.hd(r.x,r.y,r.x+r.width,r.y+r.height,
m.x,m.y,n.x,n.y,w)?(c=a=w.copy(),b=w.Xa(n)):K.hd(r.x,r.y,r.x+r.width,r.y+r.height,n.x,n.y,p.x,p.y,w)&&(c=a=w.copy(),b=w.Xa(p)));Kk(q,p.x,p.y)||(K.hd(r.x,r.y,r.x+r.width,r.y+r.height,p.x,p.y,n.x,n.y,w)?(u=p=w.copy(),d=n.Xa(w)):K.hd(r.x,r.y,r.x+r.width,r.y+r.height,n.x,n.y,m.x,m.y,w)?(u=p=w.copy(),d=m.Xa(w)):K.hd(r.x,r.y,r.x+r.width,r.y+r.height,m.x,m.y,a.x,a.y,w)&&(u=p=w.copy(),d=a.Xa(w)));J.free(w)}g=g.copy().Uc(h);g.Oc(q.Kq*q.iz,q.Jq*q.iz);Mp(q,a,b,p,d,g,!0);h=Np(q,p.x,p.y);!q.abort&&h>=Op&&(Jk(q),
g.Oc(q.Kq*q.Ty,q.Jq*q.Ty),Mp(q,a,b,p,d,g,!1),h=Np(q,p.x,p.y));if(!q.abort&&h<Op&&Np(q,p.x,p.y)!==Lk){Pp(this,q,p.x,p.y,d,!0);h=this.i(2);if(4>this.pointsCount)0===b||180===b?(h.x=a.x,h.y=p.y):(h.x=p.x,h.y=a.y),this.N(2,h.x,h.y),this.m(3,h.x,h.y);else if(g=this.i(3),0===b||180===b)K.C(h.x,g.x)?(h=0===b?Math.max(h.x,a.x):Math.min(h.x,a.x),this.N(2,h,a.y),this.N(3,h,g.y)):K.C(h.y,g.y)?(Math.abs(a.y-h.y)<=q.Jq/2&&(this.N(2,h.x,a.y),this.N(3,g.x,a.y)),this.m(2,h.x,a.y)):this.N(2,a.x,h.y);else if(90===
b||270===b)K.C(h.y,g.y)?(h=90===b?Math.max(h.y,a.y):Math.min(h.y,a.y),this.N(2,a.x,h),this.N(3,g.x,h)):K.C(h.x,g.x)?(Math.abs(a.x-h.x)<=q.Kq/2&&(this.N(2,a.x,h.y),this.N(3,a.x,g.y)),this.m(2,a.x,h.y)):this.N(2,h.x,a.y);null!==c&&(a=this.i(1),g=this.i(2),a.x!==g.x&&a.y!==g.y?0===b||180===b?this.m(2,a.x,g.y):this.m(2,g.x,a.y):0===b||180===b?this.m(2,e.x,c.y):this.m(2,c.x,e.y));null!==u&&(0===d||180===d?this.Hf(f.x,u.y):this.Hf(u.x,f.y));b=!0}else b=!1}}}else b=!1;b||(this.Oe(k),this.Oe(l))}};
R.prototype.computeMidOrthoPosition=function(a,b,c,d,e){var f=0;!this.hasCurviness()||this.computeSpot(!0,this.fromPort).Sc()||this.computeSpot(!1,this.toPort).Sc()||(f=this.computeCurviness());return e?(b+d)/2+f:(a+c)/2+f};
function dk(a){if(null===a.diagram||!a.isAvoiding||!Fk(a.diagram))return!1;var b=a.points.j,c=b.length;if(4>c)return!1;a=Gk(a.diagram,!0,a.containingGroup,null);for(var d=1;d<c-2;d++){var e=b[d],f=b[d+1];if(!a.Kk(Math.min(e.x,f.x),Math.min(e.y,f.y),Math.abs(e.x-f.x),Math.abs(e.y-f.y)))return!0}return!1}
function Pp(a,b,c,d,e,f){var g=b.Kq,h=b.Jq,k=Np(b,c,d),l=c,m=d;for(0===e?l+=g:90===e?m+=h:180===e?l-=g:m-=h;k>Qp&&Np(b,l,m)===k-1;)c=l,d=m,0===e?l+=g:90===e?m+=h:180===e?l-=g:m-=h,--k;if(f){if(k>Qp)if(180===e||0===e)c=Math.floor(c/g)*g+g/2;else if(90===e||270===e)d=Math.floor(d/h)*h+h/2}else c=Math.floor(c/g)*g+g/2,d=Math.floor(d/h)*h+h/2;k>Qp&&(f=e,l=c,m=d,0===e?(f=90,m+=h):90===e?(f=180,l-=g):180===e?(f=270,m-=h):270===e&&(f=0,l+=g),Np(b,l,m)===k-1?Pp(a,b,l,m,f,!1):(l=c,m=d,0===e?(f=270,m-=h):90===
e?(f=0,l+=g):180===e?(f=90,m+=h):270===e&&(f=180,l-=g),Np(b,l,m)===k-1&&Pp(a,b,l,m,f,!1)));a.Hf(c,d)}R.prototype.gA=function(a){F&&x(a,J,R,"findClosestSegment:p");var b=a.x;a=a.y;for(var c=this.i(0),d=this.i(1),e=Kb(b,a,c.x,c.y,d.x,d.y),f=0,g=1;g<this.pointsCount-1;g++){c=this.i(g+1);var h=Kb(b,a,d.x,d.y,c.x,c.y);d=c;h<e&&(f=g,e=h)}return f};R.prototype.ic=function(){this.mn=!1;this.v()};
R.prototype.Mk=function(a){if(!a){if(!1===this.kd)return;a=this.ub();if(this.mn&&(null===a||null!==a.geometry))return}this.ua=this.makeGeometry();a=this.path;if(null!==a){a.ua=this.ua;for(var b=this.$.j,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.isPanelMain&&e instanceof Yf&&(e.ua=this.ua)}}};
R.prototype.makeGeometry=function(){var a=this.ua,b=this.pointsCount;if(2>b)return a.type=Id,this.mn=!0,a;var c=!1,d=this.diagram;null!==d&&yp(this)&&d.hh.contains(this)&&(0!==this.dm.width||0!==this.dm.height)&&(c=!0);var e=this.i(0).copy(),f=e.copy();d=this.Fb.j;var g=this.computeCurve();if(g===rg&&3<=b&&!K.ca(this.smoothness,0))if(3===b){var h=this.i(1);d=Math.min(e.x,h.x);var k=Math.min(e.y,h.y);h=this.i(2);d=Math.min(d,h.x);k=Math.min(k,h.y)}else{if(this.isOrthogonal)for(k=0;k<b;k++)h=d[k],f.x=
Math.min(h.x,f.x),f.y=Math.min(h.y,f.y);else for(d=3;d<b;d+=3)d+3>=b&&(d=b-1),k=this.i(d),f.x=Math.min(k.x,f.x),f.y=Math.min(k.y,f.y);d=f.x;k=f.y}else{for(k=0;k<b;k++)h=d[k],f.x=Math.min(h.x,f.x),f.y=Math.min(h.y,f.y);d=f.x;k=f.y}d-=this.Iv.x;k-=this.Iv.y;e.x-=d;e.y-=k;if(2!==b||yp(this)){a.type=Gd;h=Wd(a);0!==this.computeShortLength(!0)&&(e=Rp(this,e,!0,f));Xd(h,e.x,e.y,!1);if(g===rg&&3<=b&&!K.ca(this.smoothness,0))if(3===b)c=this.i(1),b=c.x-d,c=c.y-k,e=this.i(2).copy(),e.x-=d,e.y-=k,0!==this.computeShortLength(!1)&&
(e=Rp(this,e,!1,f)),Yd(h,b,c,b,c,e.x,e.y);else if(this.isOrthogonal){f=new J(d,k);e=this.i(1).copy();g=new J(d,k);b=new J(d,k);c=this.i(0);for(var l,m=this.smoothness/3,n=1;n<this.pointsCount-1;n++){l=this.i(n);var p=c,r=l,q=this.i(Sp(this,l,n,!1));if(!K.ca(p.x,r.x)||!K.ca(r.x,q.x))if(!K.ca(p.y,r.y)||!K.ca(r.y,q.y)){var u=m;isNaN(u)&&(u=this.smoothness/3);var w=p.x;p=p.y;var y=r.x;r=r.y;var z=q.x;q=q.y;var B=u*Tp(w,p,y,r);u*=Tp(y,r,z,q);K.ca(p,r)&&K.ca(y,z)&&(y>w?q>r?(g.x=y-B,g.y=r-B,b.x=y+u,b.y=
r+u):(g.x=y-B,g.y=r+B,b.x=y+u,b.y=r-u):q>r?(g.x=y+B,g.y=r-B,b.x=y-u,b.y=r+u):(g.x=y+B,g.y=r+B,b.x=y-u,b.y=r-u));K.ca(w,y)&&K.ca(r,q)&&(r>p?(z>y?(g.x=y-B,g.y=r-B,b.x=y+u):(g.x=y+B,g.y=r-B,b.x=y-u),b.y=r+u):(z>y?(g.x=y-B,g.y=r+B,b.x=y+u):(g.x=y+B,g.y=r+B,b.x=y-u),b.y=r-u));if(K.ca(w,y)&&K.ca(y,z)||K.ca(p,r)&&K.ca(r,q))w=.5*(w+z),p=.5*(p+q),g.x=w,g.y=p,b.x=w,b.y=p;1===n?(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y)):2===n&&K.ca(c.x,this.i(0).x)&&K.ca(c.y,this.i(0).y)&&(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y));Yd(h,e.x-
d,e.y-k,g.x-d,g.y-k,l.x-d,l.y-k);f.set(g);e.set(b);c=l}}f=c.x;c=c.y;e=this.i(this.pointsCount-1);0!==this.computeShortLength(!1)&&(e=Rp(this,e.copy(),!1,Ob));f=.5*(f+e.x);c=.5*(c+e.y);Yd(h,b.x-d,b.y-k,f-d,c-k,e.x-d,e.y-k)}else for(c=3;c<b;c+=3)f=this.i(c-2),c+3>=b&&(c=b-1),e=this.i(c-1),g=this.i(c),c===b-1&&0!==this.computeShortLength(!1)&&(g=Rp(this,g.copy(),!1,Ob)),Yd(h,f.x-d,f.y-k,e.x-d,e.y-k,g.x-d,g.y-k);else{f=J.alloc();f.assign(this.i(0));e=J.alloc();e.assign(f);g=this.computeCorner();n=1;for(l=
0;n<b;){n=Sp(this,f,n,1<n);m=this.i(n);if(n>=b-1){if(!f.A(m))0!==this.computeShortLength(!1)&&(m=Rp(this,m.copy(),!1,Ob)),Up(this,h,-d,-k,f,m,c);else if(0===l)for(n=1;n<b;)e.assign(f),m=this.i(n++),Up(this,h,-d,-k,f,m,c),f.assign(m);break}l=Sp(this,m,n+1,n<b-3);n=-d;w=-k;p=m;u=this.i(l);y=c;if(K.C(f.y,p.y)&&K.C(p.x,u.x))if(r=Math.min(g,Math.abs(p.x-e.x)/2),r=z=Math.min(r,Math.abs(u.y-p.y)/2),K.C(r,0))Up(this,h,n,w,f,p,y),f.assign(p);else{q=p.x;B=p.y;var D=q,G=B;p.x>f.x?q=p.x-r:q=p.x+r;u.y>p.y?G=p.y+
z:G=p.y-z;Up(this,h,n,w,f,new J(q,B),y);Zd(h,p.x+n,p.y+w,D+n,G+w);f.h(D,G)}else K.C(f.x,p.x)&&K.C(p.y,u.y)?(r=Math.min(g,Math.abs(p.y-e.y)/2),r=z=Math.min(r,Math.abs(u.x-p.x)/2),K.C(z,0)?(Up(this,h,n,w,f,p,y),f.assign(p)):(q=p.x,B=p.y,D=q,G=B,p.y>f.y?B=p.y-r:B=p.y+r,u.x>p.x?D=p.x+z:D=p.x-z,Up(this,h,n,w,f,new J(q,B),y),Zd(h,p.x+n,p.y+w,D+n,G+w),f.h(D,G))):(Up(this,h,n,w,f,p,y),f.assign(p));e.assign(m);n=l}J.free(f)}fe=h}else h=this.i(1).copy(),h.x-=d,h.y-=k,0!==this.computeShortLength(!0)&&(e=Rp(this,
e,!0,f)),0!==this.computeShortLength(!1)&&(h=Rp(this,h,!1,f)),a.type=Id,a.startX=e.x,a.startY=e.y,a.endX=h.x,a.endY=h.y;this.mn=!0;return a};function Tp(a,b,c,d){a=c-a;if(isNaN(a)||Infinity===a||-Infinity===a)return NaN;0>a&&(a=-a);b=d-b;if(isNaN(b)||Infinity===b||-Infinity===b)return NaN;0>b&&(b=-b);return K.ca(a,0)?b:K.ca(b,0)?a:Math.sqrt(a*a+b*b)}
function Rp(a,b,c,d){var e=a.pointsCount;if(2>e)return b;if(c){var f=a.i(1);c=f.x-d.x;f=f.y-d.y;d=Tp(b.x,b.y,c,f);if(0===d)return b;e=2===e?.5*d:d;a=a.computeShortLength(!0);a>e&&(a=e);e=a*(f-b.y)/d;b.x+=a*(c-b.x)/d;b.y+=e}else{f=a.i(e-2);c=f.x-d.x;f=f.y-d.y;d=Tp(b.x,b.y,c,f);if(0===d)return b;e=2===e?.5*d:d;a=a.computeShortLength(!1);a>e&&(a=e);e=a*(b.y-f)/d;b.x-=a*(b.x-c)/d;b.y-=e}return b}
function Sp(a,b,c,d){for(var e=a.pointsCount,f=b;K.ca(b.x,f.x)&&K.ca(b.y,f.y);){if(c>=e)return e-1;f=a.i(c++)}if(!K.ca(b.x,f.x)&&!K.ca(b.y,f.y))return c-1;for(var g=f;K.ca(b.x,f.x)&&K.ca(f.x,g.x)&&(!d||(b.y>=f.y?f.y>=g.y:f.y<=g.y))||K.ca(b.y,f.y)&&K.ca(f.y,g.y)&&(!d||(b.x>=f.x?f.x>=g.x:f.x<=g.x));){if(c>=e)return e-1;g=a.i(c++)}return c-2}
function Up(a,b,c,d,e,f,g){if(!g&&yp(a)){g=[];var h=0;a.isVisible()&&(h=Vp(a,e,f,g));if(0<h)if(K.C(e.y,f.y))if(e.x<f.x)for(var k=0;k<h;){var l=Math.max(e.x,Math.min(g[k++]-5,f.x-10));b.lineTo(l+c,f.y+d);var m=l+c;for(var n=Math.min(l+10,f.x);k<h;)if(l=g[k],l<n+10)k++,n=Math.min(l+5,f.x);else break;l=f.y-10+d;n+=c;var p=f.y+d;a.curve===ng?Xd(b,n,p,!1):Yd(b,m,l,n,l,n,p)}else for(--h;0<=h;){k=Math.min(e.x,Math.max(g[h--]+5,f.x+10));b.lineTo(k+c,f.y+d);m=k+c;for(l=Math.max(k-10,f.x);0<=h;)if(k=g[h],k>
l-10)h--,l=Math.max(k-5,f.x);else break;k=f.y-10+d;l+=c;n=f.y+d;a.curve===ng?Xd(b,l,n,!1):Yd(b,m,k,l,k,l,n)}else if(K.C(e.x,f.x))if(e.y<f.y)for(k=0;k<h;){l=Math.max(e.y,Math.min(g[k++]-5,f.y-10));b.lineTo(f.x+c,l+d);m=l+d;for(l=Math.min(l+10,f.y);k<h;)if(n=g[k],n<l+10)k++,l=Math.min(n+5,f.y);else break;n=f.x-10+c;p=f.x+c;l+=d;a.curve===ng?Xd(b,p,l,!1):Yd(b,n,m,n,l,p,l)}else for(--h;0<=h;){k=Math.min(e.y,Math.max(g[h--]+5,f.y+10));b.lineTo(f.x+c,k+d);m=k+d;for(k=Math.max(k-10,f.y);0<=h;)if(l=g[h],
l>k-10)h--,k=Math.max(l-5,f.y);else break;l=f.x-10+c;n=f.x+c;k+=d;a.curve===ng?Xd(b,n,k,!1):Yd(b,l,m,l,k,n,k)}}b.lineTo(f.x+c,f.y+d)}
function Vp(a,b,c,d){var e=a.diagram;if(null===e||b.A(c))return 0;for(e=e.layers;e.next();){var f=e.value;if(null!==f&&f.visible){f=f.Ia.j;for(var g=f.length,h=0;h<g;h++){var k=f[h];if(k instanceof R){if(k===a)return 0<d.length&&d.sort(function(a,b){return a-b}),d.length;if(k.isVisible()&&yp(k)){var l=k.routeBounds;l.o()&&a.routeBounds.Rc(l)&&!a.usesSamePort(k)&&(l=k.path,null!==l&&l.Rf()&&Wp(b,c,d,k))}}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length}
function Wp(a,b,c,d){for(var e=K.C(a.y,b.y),f=d.pointsCount,g=d.i(0),h=J.alloc(),k=1;k<f;k++){var l=d.i(k);if(k<f-1){var m=d.i(k+1);if(g.y===l.y&&l.y===m.y){if(l.x>g.x&&m.x>=l.x||l.x<g.x&&m.x<=l.x)continue}else if(g.x===l.x&&l.x===m.x&&(l.y>g.y&&m.y>=l.y||l.y<g.y&&m.y<=l.y))continue}a:{m=a.x;var n=a.y,p=b.x,r=b.y,q=g.x;g=g.y;var u=l.x,w=l.y;if(!K.C(m,p)){if(K.C(n,r)&&K.C(q,u)&&Math.min(m,p)<q&&Math.max(m,p)>q&&Math.min(g,w)<n&&Math.max(g,w)>n&&!K.C(g,w)){h.x=q;h.y=n;m=!0;break a}}else if(!K.C(n,r)&&
K.C(g,w)&&Math.min(n,r)<g&&Math.max(n,r)>g&&Math.min(q,u)<m&&Math.max(q,u)>m&&!K.C(q,u)){h.x=m;h.y=g;m=!0;break a}h.x=0;h.y=0;m=!1}m&&(e?c.push(h.x):c.push(h.y));g=l}J.free(h)}function yp(a){a=a.curve;return a===mg||a===ng}function Cp(a,b){if(b||yp(a))b=a.diagram,null===b||b.animationManager.isTicking||b.hh.contains(a)||0===a.dm.width&&0===a.dm.height||b.hh.add(a,a.dm.copy())}
R.prototype.$q=function(a){var b=this.layer;if(null!==b&&b.visible&&!b.isTemporary){var c=b.diagram;if(null!==c&&!c.animationManager.isTicking){var d=!1;for(c=c.layers;c.next();){var e=c.value;if(e.visible)if(e===b){d=!0;var f=!1;e=e.Ia.j;for(var g=e.length,h=0;h<g;h++){var k=e[h];k instanceof R&&(k===this?f=!0:f&&Xp(this,k,a))}}else if(d)for(f=e.Ia.j,e=f.length,g=0;g<e;g++)h=f[g],h instanceof R&&Xp(this,h,a)}}}};
function Xp(a,b,c){if(null!==b&&b.mn&&b.kd&&yp(b)){var d=b.routeBounds;d.o()&&(a.routeBounds.Rc(d)||c.Rc(d))&&(a.usesSamePort(b)||b.ic())}}R.prototype.usesSamePort=function(a){var b=this.pointsCount,c=a.pointsCount;if(0<b&&0<c){var d=this.i(0),e=a.i(0);if(d.Ta(e))return!0;b=this.i(b-1);a=a.i(c-1);if(b.Ta(a)||d.Ta(a)||b.Ta(e))return!0}else if(this.fromNode===a.fromNode||this.toNode===a.toNode||this.fromNode===a.toNode||this.toNode===a.fromNode)return!0;return!1};
R.prototype.isVisible=function(){if(!S.prototype.isVisible.call(this))return!1;var a=this.containingGroup,b=!0,c=this.diagram;null!==c&&(b=c.isTreePathToChildren);c=this.fromNode;if(null!==c){if(this.isTreeLink&&b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(var d=c;null!==d;){if(d.labeledLink===this)return!0;d=d.containingGroup}c=c.findVisibleNode();if(null===c||c===a)return!1}c=this.toNode;if(null!==c){if(this.isTreeLink&&!b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(b=c;null!==b;){if(b.labeledLink===
this)return!0;b=b.containingGroup}b=c.findVisibleNode();if(null===b||b===a)return!1}return!0};R.prototype.Ub=function(a){S.prototype.Ub.call(this,a);null!==this.Xf&&this.Xf.Mm();if(null!==this.od)for(var b=this.od.iterator;b.next();)b.value.Ub(a)};R.prototype.computeAdjusting=function(){return this.isAvoiding&&null!==this.diagram&&this.diagram.animationManager.isAnimating?up:this.cl};
function zp(a){var b=a.gf;if(null!==b){var c=a.Df;if(null!==c){for(var d=a.hf,e=a.Ef,f=a=null,g=b.fb.j,h=g.length,k=0;k<h;k++){var l=g[k];if(l.gf===b&&l.hf===d&&l.Df===c&&l.Ef===e||l.gf===c&&l.hf===e&&l.Df===b&&l.Ef===d)null===f?f=l:(null===a&&(a=[],a.push(f)),a.push(l))}if(null!==a){f=ep(b,c,d,e);null===f&&(f=new Yp(b,d,c,e),dp(b,f),dp(c,f));f.links=a;for(b=0;b<a.length;b++)a[b].Xf=f;f.Mm()}}}}function Ap(a){var b=a.Xf;null!==b&&(a.Xf=null,a=b.links.indexOf(a),0<=a&&(Ka(b.links,a),b.Mm()))}
R.prototype.$h=function(){return!0};
ma.Object.defineProperties(R.prototype,{fromNode:{configurable:!0,get:function(){return this.gf},set:function(a){var b=this.gf;if(b!==a){F&&null!==a&&x(a,U,R,"fromNode");var c=this.fromPort;null!==b&&(this.Df!==b&&ip(b,this,c),Ap(this),this.D(2));this.gf=a;null!==a&&this.Ub(a.isVisible());this.fg=null;this.Za();var d=this.diagram;null!==d&&d.ba&&d.partManager.setFromNodeForLink(this,a,b);var e=this.fromPort,f=this.fromPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.ba,d.ba=!0);f(this,
c,e);null!==d&&(d.ba=g)}null!==a&&(this.Df!==a&&hp(a,this,e),zp(this),this.D(1));this.g("fromNode",b,a);bp(this)}}},fromPortId:{configurable:!0,get:function(){return this.hf},set:function(a){var b=this.hf;if(b!==a){F&&A(a,"string",R,"fromPortId");var c=this.fromPort;null!==c&&fp(this.fromNode,c);Ap(this);this.hf=a;var d=this.fromPort;null!==d&&fp(this.fromNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.Bj()&&g.Pw(f,a)}c!==d&&(this.fg=null,this.Za(),f=this.fromPortChanged,
null!==f&&(g=!0,null!==e&&(g=e.ba,e.ba=!0),f(this,c,d),null!==e&&(e.ba=g)));zp(this);this.g("fromPortId",b,a)}}},fromPort:{configurable:!0,get:function(){var a=this.gf;return null===a?null:a.Xt(this.hf)}},fromPortChanged:{configurable:!0,get:function(){return this.so},set:function(a){var b=this.so;b!==a&&(null!==a&&A(a,"function",R,"fromPortChanged"),this.so=a,this.g("fromPortChanged",b,a))}},toNode:{configurable:!0,get:function(){return this.Df},set:function(a){var b=
this.Df;if(b!==a){F&&null!==a&&x(a,U,R,"toNode");var c=this.toPort;null!==b&&(this.gf!==b&&ip(b,this,c),Ap(this),this.D(2));this.Df=a;null!==a&&this.Ub(a.isVisible());this.fg=null;this.Za();var d=this.diagram;null!==d&&d.ba&&d.partManager.setToNodeForLink(this,a,b);var e=this.toPort,f=this.toPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.ba,d.ba=!0);f(this,c,e);null!==d&&(d.ba=g)}null!==a&&(this.gf!==a&&hp(a,this,e),zp(this),this.D(1));this.g("toNode",b,a);bp(this)}}},toPortId:{configurable:!0,
enumerable:!0,get:function(){return this.Ef},set:function(a){var b=this.Ef;if(b!==a){F&&A(a,"string",R,"toPortId");var c=this.toPort;null!==c&&fp(this.toNode,c);Ap(this);this.Ef=a;var d=this.toPort;null!==d&&fp(this.toNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.Bj()&&g.Uw(f,a)}c!==d&&(this.fg=null,this.Za(),f=this.toPortChanged,null!==f&&(g=!0,null!==e&&(g=e.ba,e.ba=!0),f(this,c,d),null!==e&&(e.ba=g)));zp(this);this.g("toPortId",b,a)}}},toPort:{configurable:!0,
get:function(){var a=this.Df;return null===a?null:a.Xt(this.Ef)}},toPortChanged:{configurable:!0,get:function(){return this.xq},set:function(a){var b=this.xq;b!==a&&(null!==a&&A(a,"function",R,"toPortChanged"),this.xq=a,this.g("toPortChanged",b,a))}},fromSpot:{configurable:!0,get:function(){return null!==this.S?this.S.nh:ld},set:function(a){this.Pc();var b=this.S.nh;if(!b.A(a)){F&&x(a,M,R,"fromSpot");a=a.J();this.S.nh=a;this.g("fromSpot",b,a);if(b.Sc()||a.Sc())a=this.fromNode,
null!==a&&fp(a,this.fromPort);this.Za()}}},fromEndSegmentLength:{configurable:!0,get:function(){return null!==this.S?this.S.lh:NaN},set:function(a){this.Pc();var b=this.S.lh;b!==a&&(F&&A(a,"number",R,"fromEndSegmentLength"),0>a&&ya(a,">= 0",R,"fromEndSegmentLength"),this.S.lh=a,this.g("fromEndSegmentLength",b,a),this.Za())}},fromShortLength:{configurable:!0,get:function(){return null!==this.S?this.S.mh:NaN},set:function(a){this.Pc();var b=this.S.mh;b!==a&&(F&&A(a,"number",
R,"fromShortLength"),this.S.mh=a,this.ic(),this.g("fromShortLength",b,a))}},toSpot:{configurable:!0,get:function(){return null!==this.S?this.S.Nh:ld},set:function(a){this.Pc();var b=this.S.Nh;if(!b.A(a)){F&&x(a,M,R,"toSpot");a=a.J();this.S.Nh=a;this.g("toSpot",b,a);if(b.Sc()||a.Sc())a=this.toNode,null!==a&&fp(a,this.toPort);this.Za()}}},toEndSegmentLength:{configurable:!0,get:function(){return null!==this.S?this.S.Lh:NaN},set:function(a){this.Pc();var b=this.S.Lh;b!==a&&
(F&&A(a,"number",R,"toEndSegmentLength"),0>a&&ya(a,">= 0",R,"toEndSegmentLength"),this.S.Lh=a,this.g("toEndSegmentLength",b,a),this.Za())}},toShortLength:{configurable:!0,get:function(){return null!==this.S?this.S.Mh:NaN},set:function(a){this.Pc();var b=this.S.Mh;b!==a&&(F&&A(a,"number",R,"toShortLength"),this.S.Mh=a,this.ic(),this.g("toShortLength",b,a))}},isLabeledLink:{configurable:!0,get:function(){return null===this.od?!1:0<this.od.count}},labelNodes:{configurable:!0,
enumerable:!0,get:function(){return null===this.od?lb:this.od.iterator}},relinkableFrom:{configurable:!0,get:function(){return 0!==(this.Ka&1)},set:function(a){var b=0!==(this.Ka&1);b!==a&&(F&&A(a,"boolean",R,"relinkableFrom"),this.Ka^=1,this.g("relinkableFrom",b,a),this.Rb())}},relinkableTo:{configurable:!0,get:function(){return 0!==(this.Ka&2)},set:function(a){var b=0!==(this.Ka&2);b!==a&&(F&&A(a,"boolean",R,"relinkableTo"),this.Ka^=2,this.g("relinkableTo",b,a),this.Rb())}},
resegmentable:{configurable:!0,get:function(){return 0!==(this.Ka&4)},set:function(a){var b=0!==(this.Ka&4);b!==a&&(F&&A(a,"boolean",R,"resegmentable"),this.Ka^=4,this.g("resegmentable",b,a),this.Rb())}},isTreeLink:{configurable:!0,get:function(){return 0!==(this.Ka&8)},set:function(a){var b=0!==(this.Ka&8);b!==a&&(F&&A(a,"boolean",R,"isTreeLink"),this.Ka^=8,this.g("isTreeLink",b,a),null!==this.fromNode&&Sk(this.fromNode),null!==this.toNode&&Sk(this.toNode))}},path:{configurable:!0,
enumerable:!0,get:function(){var a=this.ub();return a instanceof Yf?a:null}},routeBounds:{configurable:!0,get:function(){this.Ij();var a=this.dm,b=Infinity,c=Infinity,d=this.pointsCount;if(0===d)a.h(NaN,NaN,0,0);else{if(1===d)d=this.i(0),b=Math.min(d.x,b),c=Math.min(d.y,c),a.h(d.x,d.y,0,0);else if(2===d){d=this.i(0);var e=this.i(1);b=Math.min(d.x,e.x);c=Math.min(d.y,e.y);a.h(d.x,d.y,0,0);a.Ze(e)}else if(this.computeCurve()===rg&&3<=d&&!this.isOrthogonal)if(e=this.i(0),b=e.x,c=e.y,a.h(b,
c,0,0),3===d){d=this.i(1);b=Math.min(d.x,b);c=Math.min(d.y,c);var f=this.i(2);b=Math.min(f.x,b);c=Math.min(f.y,c);K.Cm(e.x,e.y,d.x,d.y,d.x,d.y,f.x,f.y,.5,a)}else for(f=3;f<d;f+=3){var g=this.i(f-2);f+3>=d&&(f=d-1);var h=this.i(f-1),k=this.i(f);K.Cm(e.x,e.y,g.x,g.y,h.x,h.y,k.x,k.y,.5,a);b=Math.min(k.x,b);c=Math.min(k.y,c);e=k}else for(e=this.i(0),f=this.i(1),b=Math.min(e.x,f.x),c=Math.min(e.y,f.y),a.h(e.x,e.y,0,0),a.Ze(f),e=2;e<d;e++)f=this.i(e),b=Math.min(f.x,b),c=Math.min(f.y,c),a.Ze(f);this.Iv.h(b-
a.x,c-a.y)}return a}},midPoint:{configurable:!0,get:function(){this.Ij();return this.computeMidPoint(new J)}},midAngle:{configurable:!0,get:function(){this.Ij();return this.computeMidAngle()}},flattenedLengths:{configurable:!0,get:function(){if(null===this.qs){this.kd||Bp(this);for(var a=this.qs=[],b=this.pointsCount,c=0;c<b-1;c++){var d=this.i(c);var e=this.i(c+1);K.ca(d.x,e.x)?(d=e.y-d.y,0>d&&(d=-d)):K.ca(d.y,e.y)?(d=e.x-d.x,0>d&&(d=-d)):d=Math.sqrt(d.Se(e));
a.push(d)}}return this.qs}},flattenedTotalLength:{configurable:!0,get:function(){var a=this.bv;if(isNaN(a)){for(var b=this.flattenedLengths,c=b.length,d=a=0;d<c;d++)a+=b[d];this.bv=a}return a}},points:{configurable:!0,get:function(){return this.Fb},set:function(a){var b=this.Fb;if(b!==a){var c=null;if(Array.isArray(a)){var d=0===a.length%2;if(d)for(var e=0;e<a.length;e++)if("number"!==typeof a[e]||isNaN(a[e])){d=!1;break}if(d)for(c=new H,d=0;d<a.length/2;d++)e=(new J(a[2*
d],a[2*d+1])).freeze(),c.add(e);else{d=!0;for(e=0;e<a.length;e++){var f=a[e];if(!Fa(f)||"number"!==typeof f.x||isNaN(f.x)||"number"!==typeof f.y||isNaN(f.y)){d=!1;break}}if(d)for(c=new H,d=0;d<a.length;d++)e=a[d],c.add((new J(e.x,e.y)).freeze());else F&&v("Link.points array must contain only an even number of numbers or objects with x and y properties, not: "+a)}}else if(a instanceof H)for(c=a.copy(),a=c.iterator;a.next();)a.value.freeze();else v("Link.points value is not an instance of List or Array: "+
a);c.freeze();this.Fb=c;this.ic();Bp(this);a=this.diagram;null!==a&&(a.Aj||a.undoManager.isUndoingRedoing||a.ju.add(this),a.animationManager.xc&&(this.Cg=c));this.g("points",b,c)}}},pointsCount:{configurable:!0,get:function(){return this.Fb.count}},kd:{configurable:!0,get:function(){return 0!==(this.Ka&16)},set:function(a){0!==(this.Ka&16)!==a&&(this.Ka^=16)}},suspendsRouting:{configurable:!0,get:function(){return 0!==(this.Ka&32)},set:function(a){0!==(this.Ka&
32)!==a&&(this.Ka^=32)}},Pt:{configurable:!0,get:function(){return 0!==(this.Ka&64)},set:function(a){0!==(this.Ka&64)!==a&&(this.Ka^=64)}},defaultFromPoint:{configurable:!0,get:function(){return this.w},set:function(a){this.w=a.copy()}},defaultToPoint:{configurable:!0,get:function(){return this.L},set:function(a){this.L=a.copy()}},isOrthogonal:{configurable:!0,get:function(){return 2===(this.lk.value&2)}},isAvoiding:{configurable:!0,
get:function(){return 4===(this.lk.value&4)}},mn:{configurable:!0,get:function(){return 0!==(this.Ka&128)},set:function(a){0!==(this.Ka&128)!==a&&(this.Ka^=128)}},geometry:{configurable:!0,get:function(){this.mn||(this.Ij(),this.ua=this.makeGeometry());return this.ua}},firstPickIndex:{configurable:!0,get:function(){return 2>=this.pointsCount?0:this.isOrthogonal||!Dp(this.computeSpot(!0))?1:0}},lastPickIndex:{configurable:!0,get:function(){var a=
this.pointsCount;return 0===a?0:2>=a?a-1:this.isOrthogonal||!Dp(this.computeSpot(!1))?a-2:a-1}},adjusting:{configurable:!0,get:function(){return this.cl},set:function(a){var b=this.cl;b!==a&&(F&&hb(a,R,R,"adjusting"),this.cl=a,this.g("adjusting",b,a))}},corner:{configurable:!0,get:function(){return this.Tn},set:function(a){var b=this.Tn;b!==a&&(F&&A(a,"number",R,"corner"),this.Tn=a,this.ic(),this.g("corner",b,a))}},curve:{configurable:!0,get:function(){return this.Vn},
set:function(a){var b=this.Vn;b!==a&&(F&&hb(a,R,R,"curve"),this.Vn=a,this.Za(),this.ic(),Cp(this,b===ng||b===mg||a===ng||a===mg),this.g("curve",b,a))}},curviness:{configurable:!0,get:function(){return this.Wn},set:function(a){var b=this.Wn;b!==a&&(F&&A(a,"number",R,"curviness"),this.Wn=a,this.Za(),this.ic(),this.g("curviness",b,a))}},routing:{configurable:!0,get:function(){return this.lk},set:function(a){var b=this.lk;b!==a&&(F&&hb(a,R,R,"routing"),this.lk=a,this.fg=null,
this.Za(),Cp(this,2===(b.value&2)||2===(a.value&2)),this.g("routing",b,a))}},smoothness:{configurable:!0,get:function(){return this.kq},set:function(a){var b=this.kq;b!==a&&(F&&A(a,"number",R,"smoothness"),this.kq=a,this.ic(),this.g("smoothness",b,a))}},key:{configurable:!0,get:function(){var a=this.diagram;if(null!==a&&a.model.Bj())return a.model.ac(this.data)}}});R.prototype.invalidateOtherJumpOvers=R.prototype.$q;R.prototype.findClosestSegment=R.prototype.gA;
R.prototype.updateRoute=R.prototype.Ij;R.prototype.invalidateRoute=R.prototype.Za;R.prototype.rollbackRoute=R.prototype.Lw;R.prototype.commitRoute=R.prototype.Jf;R.prototype.startRoute=R.prototype.di;R.prototype.clearPoints=R.prototype.yk;R.prototype.removePoint=R.prototype.Gw;R.prototype.addPointAt=R.prototype.Hf;R.prototype.addPoint=R.prototype.Oe;R.prototype.insertPointAt=R.prototype.m;R.prototype.insertPoint=R.prototype.LA;R.prototype.setPointAt=R.prototype.N;R.prototype.setPoint=R.prototype.ud;
R.prototype.getPoint=R.prototype.i;R.prototype.getOtherPort=R.prototype.CA;R.prototype.getOtherNode=R.prototype.Vq;
var tp=new E(R,"Normal",1),Zp=new E(R,"Orthogonal",2),$p=new E(R,"AvoidsNodes",6),Ip=new E(R,"AvoidsNodesStraight",7),og=new E(R,"None",0),rg=new E(R,"Bezier",9),ng=new E(R,"JumpGap",10),mg=new E(R,"JumpOver",11),up=new E(R,"End",17),vp=new E(R,"Scale",18),wp=new E(R,"Stretch",19),jn=new E(R,"OrientAlong",21),bn=new E(R,"OrientPlus90",22),dn=new E(R,"OrientMinus90",23),xp=new E(R,"OrientOpposite",24),kn=new E(R,"OrientUpright",25),cn=new E(R,"OrientPlus90Upright",26),en=new E(R,"OrientMinus90Upright",
27),fn=new E(R,"OrientUpright45",28),Kp=16,Jp=14,Lp=8;R.className="Link";R.Normal=tp;R.Orthogonal=Zp;R.AvoidsNodes=$p;R.AvoidsNodesStraight=Ip;R.None=og;R.Bezier=rg;R.JumpGap=ng;R.JumpOver=mg;R.End=up;R.Scale=vp;R.Stretch=wp;R.OrientAlong=jn;R.OrientPlus90=bn;R.OrientMinus90=dn;R.OrientOpposite=xp;R.OrientUpright=kn;R.OrientPlus90Upright=cn;R.OrientMinus90Upright=en;R.OrientUpright45=fn;R.EndSegmentStep=8;R.CurvinessStart=Kp;R.SpacingMin=Jp;R.OrthoShortCut=Lp;R.AvoidanceCell=8;R.AvoidanceLimit=999;
function Yp(a,b,c,d){fb(this);this.ye=this.xs=!1;this.mu=a;this.Zy=b;this.xw=c;this.$y=d;this.links=[]}Yp.prototype.Mm=function(){if(!this.xs){var a=this.links;0<a.length&&(a=a[0].diagram,null!==a&&(a.dv.add(this),this.ye=a.undoManager.isUndoingRedoing))}this.xs=!0};
Yp.prototype.jx=function(){if(this.xs){this.xs=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.diagram;c=null===c||c.Aj&&!this.ye;this.ye=!1;b.arrangeBundledLinks(a,c);1===a.length&&(b.Xf=null,a.length=0)}0===a.length&&(a=this.mu,null!==this&&null!==a.cf&&a.cf.remove(this),a=this.xw,null!==this&&null!==a.cf&&a.cf.remove(this))}};Yp.className="LinkBundle";
function Hk(){fb(this);this.hz=this.group=null;this.du=!0;this.abort=!1;this.Cd=this.Bd=1;this.ap=this.$o=-1;this.lc=this.kc=8;this.Wb=null;this.kj=this.jj=0;this.iz=11;this.Ty=124}
Hk.prototype.initialize=function(a){if(!(0>=a.width||0>=a.height)){var b=a.y,c=a.x+a.width,d=a.y+a.height;this.Bd=Math.floor((a.x-this.kc)/this.kc)*this.kc;this.Cd=Math.floor((b-this.lc)/this.lc)*this.lc;this.$o=Math.ceil((c+2*this.kc)/this.kc)*this.kc;this.ap=Math.ceil((d+2*this.lc)/this.lc)*this.lc;a=1+(Math.ceil((this.$o-this.Bd)/this.kc)|0);b=1+(Math.ceil((this.ap-this.Cd)/this.lc)|0);if(null===this.Wb||this.jj<a-1||this.kj<b-1){c=[];for(d=0;d<=a;d++)c[d]=new Uint32Array(b);this.Wb=c;this.jj=
a-1;this.kj=b-1}a=aq;if(null!==this.Wb)for(b=0;b<=this.jj;b++)if(c=this.Wb[b],c.fill)c.fill(a);else for(d=0;d<=this.kj;d++)c[d]=a}};function Kk(a,b,c){return a.Bd<=b&&b<=a.$o&&a.Cd<=c&&c<=a.ap}function Np(a,b,c){if(!Kk(a,b,c))return aq;b-=a.Bd;b/=a.kc;c-=a.Cd;c/=a.lc;return a.Wb[b|0][c|0]}function Jk(a){if(null!==a.Wb)for(var b=0;b<=a.jj;b++)for(var c=a.Wb[b],d=0;d<=a.kj;d++)c[d]>=Qp&&(c[d]=aq)}
Hk.prototype.Kk=function(a,b,c,d){if(a>this.$o||a+c<this.Bd||b>this.ap||b+d<this.Cd)return!0;a=(a-this.Bd)/this.kc|0;b=(b-this.Cd)/this.lc|0;c=Math.max(0,c)/this.kc+1|0;var e=Math.max(0,d)/this.lc+1|0;0>a&&(c+=a,a=0);0>b&&(e+=b,b=0);if(0>c||0>e)return!0;d=Math.min(a+c-1,this.jj)|0;for(c=Math.min(b+e-1,this.kj)|0;a<=d;a++){e=this.Wb[a];for(var f=b;f<=c;f++)if(e[f]===Lk)return!1}return!0};
function bq(a,b,c,d,e,f,g,h,k){if(!(b<f||b>g||c<h||c>k)){var l=b|0;var m=c|0;var n=a.Wb[l][m];if(n>=Qp&&n<Op)for(e?m+=d:l+=d,n+=1;f<=l&&l<=g&&h<=m&&m<=k&&!(n>=a.Wb[l][m]);)a.Wb[l][m]=n,n+=1,e?m+=d:l+=d;l=e?m:l;if(e)if(0<d)for(c+=d;c<l;c+=d)bq(a,b,c,1,!e,f,g,h,k),bq(a,b,c,-1,!e,f,g,h,k);else for(c+=d;c>l;c+=d)bq(a,b,c,1,!e,f,g,h,k),bq(a,b,c,-1,!e,f,g,h,k);else if(0<d)for(b+=d;b<l;b+=d)bq(a,b,c,1,!e,f,g,h,k),bq(a,b,c,-1,!e,f,g,h,k);else for(b+=d;b>l;b+=d)bq(a,b,c,1,!e,f,g,h,k),bq(a,b,c,-1,!e,f,g,h,
k)}}function cq(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=Lk,m=Qp;for(a.Wb[b][c]=m;l===Lk&&b>f&&b<g&&c>h&&c<k;)m+=1,a.Wb[b][c]=m,e?c+=d:b+=d,l=a.Wb[b][c]}function dq(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=Lk,m=Op;for(a.Wb[b][c]=m;l===Lk&&b>f&&b<g&&c>h&&c<k;)a.Wb[b][c]=m,e?c+=d:b+=d,l=a.Wb[b][c]}
function Mp(a,b,c,d,e,f,g){if(null!==a.Wb){a.abort=!1;var h=b.x,k=b.y;if(Kk(a,h,k)){h-=a.Bd;h/=a.kc;k-=a.Cd;k/=a.lc;var l=d.x,m=d.y;if(Kk(a,l,m))if(l-=a.Bd,l/=a.kc,m-=a.Cd,m/=a.lc,1>=Math.abs(h-l)&&1>=Math.abs(k-m))a.abort=!0;else{var n=f.x;d=f.y;b=f.x+f.width;var p=f.y+f.height;n-=a.Bd;n/=a.kc;d-=a.Cd;d/=a.lc;b-=a.Bd;b/=a.kc;p-=a.Cd;p/=a.lc;f=Math.max(0,Math.min(a.jj,n|0));b=Math.min(a.jj,Math.max(0,b|0));n=Math.max(0,Math.min(a.kj,d|0));p=Math.min(a.kj,Math.max(0,p|0));d=a.Wb;h|=0;k|=0;l|=0;m|=
0;var r=0===c||90===c?1:-1;c=90===c||270===c;d[h][k]===Lk?(cq(a,h,k,r,c,f,b,n,p),cq(a,h,k,1,!c,f,b,n,p),cq(a,h,k,-1,!c,f,b,n,p)):cq(a,h,k,r,c,h,k,h,k);d[l][m]===Lk?(dq(a,l,m,0===e||90===e?1:-1,90===e||270===e,f,b,n,p),dq(a,l,m,1,!(90===e||270===e),f,b,n,p),dq(a,l,m,-1,!(90===e||270===e),f,b,n,p)):dq(a,l,m,r,c,l,m,l,m);c=La();if(g&&eq(a,l,m,e,h,k,c)){if(c[0]!==l||c[1]!==m)c.unshift(m),c.unshift(l);if(c[c.length-2]!==h||c[c.length-1]!==k)c.push(h),c.push(k);a=Qp;e=c[c.length-2];g=c[c.length-1];d[e][g]=
a++;for(f=c.length-4;0<=f;f-=2)for(e=c[f+2],g=c[f+3],b=c[f],l=c[f+1];b>e?e++:b<e?e--:l>g?g++:l<g&&g--,d[e][g]=a++,e!==b||g!==l;);}else bq(a,h,k,1,!1,f,b,n,p),bq(a,h,k,-1,!1,f,b,n,p),bq(a,h,k,1,!0,f,b,n,p),bq(a,h,k,-1,!0,f,b,n,p);Oa(c)}}}}
function eq(a,b,c,d,e,f,g){for(var h=a.Wb,k=b,l=c;;){if(k===e&&l===f)return!0;var m=k,n=l;if(0===d)if(m<e)m++;else break;else if(90===d)if(n<f)n++;else break;else if(180===d)if(m>e)m--;else break;else if(n>f)n--;else break;var p=h[m][n];if(0===p||p===fq)break;k=m;l=n}for(;;){m=d;n=k;p=l;0===d?p<f?(m=90,p++):p>f&&(m=270,p--):90===d?n<e?(m=0,n++):n>e&&(m=180,n--):180===d?p<f?(m=90,p++):p>f&&(m=270,p--):n<e?(m=0,n++):n>e&&(m=180,n--);n=h[n][p];if(m!==d&&0!==n&&n!==fq){g.push(k);g.push(l);if(eq(a,k,l,
m,e,f,g))return!0;g.pop();g.pop()}h[k][l]=fq;if(0===d){if(k===b)return!1;k--}else if(90===d){if(l===c)return!1;l--}else if(180===d){if(k===b)return!1;k++}else{if(l===c)return!1;l++}}}
ma.Object.defineProperties(Hk.prototype,{bounds:{configurable:!0,get:function(){return new L(this.Bd,this.Cd,this.$o-this.Bd,this.ap-this.Cd)}},Kq:{configurable:!0,get:function(){return this.kc},set:function(a){0<a&&a!==this.kc&&(this.kc=a,this.initialize(this.bounds))}},Jq:{configurable:!0,get:function(){return this.lc},set:function(a){0<a&&a!==this.lc&&(this.lc=a,this.initialize(this.bounds))}}});var Lk=0,Qp=1,Op=999999,aq=Op+1,fq=Op+2;Hk.className="PositionArray";
function Gp(){fb(this);this.port=this.node=null;this.he=[];this.fr=!1}Gp.prototype.toString=function(){for(var a=this.he,b=this.node.toString()+" "+a.length.toString()+":",c=0;c<a.length;c++){var d=a[c];null!==d&&(b+="\n  "+d.toString())}return b};
function gq(a,b,c,d){b=b.offsetY;switch(b){case 8:return 90;case 2:return 180;case 1:return 270;case 4:return 0}switch(b){case 9:return 180<c?270:90;case 6:return 90<c&&270>=c?180:0}a=180*Math.atan2(a.height,a.width)/Math.PI;switch(b){case 3:return c>a&&c<=180+a?180:270;case 5:return c>180-a&&c<=360-a?270:0;case 12:return c>a&&c<=180+a?90:0;case 10:return c>180-a&&c<=360-a?180:90;case 7:return 90<c&&c<=180+a?180:c>180+a&&c<=360-a?270:0;case 13:return 180<c&&c<=360-a?270:c>a&&180>=c?90:0;case 14:return c>
a&&c<=180-a?90:c>180-a&&270>=c?180:0;case 11:return c>180-a&&c<=180+a?180:c>180+a?270:90}d&&15!==b&&(c-=15,0>c&&(c+=360));return c>a&&c<180-a?90:c>=180-a&&c<=180+a?180:c>180+a&&c<360-a?270:0}Gp.prototype.Mm=function(){this.he.length=0};
function Hp(a,b){var c=a.he;if(0===c.length){a:if(!a.fr){c=a.fr;a.fr=!0;var d=null,e=a.node,f=e instanceof Hf?e:null;if(null===f||f.isSubGraphExpanded)var g=e.isTreeExpanded?e.findLinksConnected(a.port.portId):e.Cy();else{if(!f.actualBounds.o()){a.fr=c;break a}d=f;g=d.ew()}f=a.he.length=0;var h=a.port.ma(Hc,J.alloc()),k=a.port.ma(Sc,J.alloc());e=L.allocAt(h.x,h.y,0,0);e.Ze(k);J.free(h);J.free(k);h=J.allocAt(e.x+e.width/2,e.y+e.height/2);k=a.port.wj();for(g=g.iterator;g.next();){var l=g.value;if(l.isVisible()&&
l.fromPort!==l.toPort){var m=l.fromPort===a.port||null!==l.fromNode&&l.fromNode.Jd(d),n=l.computeSpot(m,a.port);if(n.Sc()&&(m=m?l.toPort:l.fromPort,null!==m)){var p=m.part;if(null!==p){var r=p.findVisibleNode();null!==r&&r!==p&&(p=r,m=p.port);m=l.computeOtherPoint(p,m);p=h.Xa(m);p-=k;0>p?p+=360:360<=p&&(p-=360);n=gq(e,n,p,l.isOrthogonal);0===n?(n=4,180<p&&(p-=360)):90===n?(n=8,270<p&&(p-=360)):180===n?n=2:(n=1,90>p&&(p+=360));r=a.he[f];void 0===r?(r=new hq(l,p,n),a.he[f]=r):(r.link=l,r.angle=p,r.Gc=
n);r.zw.set(m);f++}}}}J.free(h);a.he.sort(Gp.prototype.l);k=a.he.length;d=-1;for(f=h=0;f<k;f++)g=a.he[f],void 0!==g&&(g.Gc!==d&&(d=g.Gc,h=0),g.Wq=h,h++);d=-1;h=0;for(f=k-1;0<=f;f--)k=a.he[f],void 0!==k&&(k.Gc!==d&&(d=k.Gc,h=k.Wq+1),k.Em=h);f=a.he;n=a.port;d=a.node.portSpreading;h=J.alloc();k=J.alloc();g=J.alloc();l=J.alloc();n.ma(Hc,h);n.ma(Jc,k);n.ma(Sc,g);n.ma(Oc,l);r=p=m=n=0;if(d===qp)for(var q=0;q<f.length;q++){var u=f[q];if(null!==u){var w=u.link.computeThickness();switch(u.Gc){case 8:p+=w;break;
case 2:r+=w;break;case 1:n+=w;break;default:case 4:m+=w}}}var y=q=0,z=1,B=u=0;for(w=0;w<f.length;w++){var D=f[w];if(null!==D){if(q!==D.Gc){q=D.Gc;switch(q){case 8:var G=g;y=l;break;case 2:G=l;y=h;break;case 1:G=h;y=k;break;default:case 4:G=k,y=g}u=y.x-G.x;B=y.y-G.y;switch(q){case 8:p>Math.abs(u)?(z=Math.abs(u)/p,p=Math.abs(u)):z=1;break;case 2:r>Math.abs(B)?(z=Math.abs(B)/r,r=Math.abs(B)):z=1;break;case 1:n>Math.abs(u)?(z=Math.abs(u)/n,n=Math.abs(u)):z=1;break;default:case 4:m>Math.abs(B)?(z=Math.abs(B)/
m,m=Math.abs(B)):z=1}y=0}var O=D.dr;if(d===qp){D=D.link.computeThickness();D*=z;O.set(G);switch(q){case 8:O.x=G.x+u/2+p/2-y-D/2;break;case 2:O.y=G.y+B/2+r/2-y-D/2;break;case 1:O.x=G.x+u/2-n/2+y+D/2;break;default:case 4:O.y=G.y+B/2-m/2+y+D/2}y+=D}else{var T=.5;d===cp&&(T=(D.Wq+1)/(D.Em+1));O.x=G.x+u*T;O.y=G.y+B*T}}}J.free(h);J.free(k);J.free(g);J.free(l);G=a.he;for(f=0;f<G.length;f++)d=G[f],null!==d&&(d.cw=a.computeEndSegmentLength(d));a.fr=c;L.free(e)}c=a.he}for(a=0;a<c.length;a++)if(e=c[a],null!==
e&&e.link===b)return e;return null}Gp.prototype.l=function(a,b){return a===b?0:null===a?-1:null===b?1:a.Gc<b.Gc?-1:a.Gc>b.Gc?1:a.angle<b.angle?-1:a.angle>b.angle?1:0};
Gp.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.node,this.port,Gc,b.fromPort===this.port),d=a.Wq;if(0>d)return c;var e=a.Em;if(1>=e||!b.isOrthogonal)return c;b=a.zw;var f=a.dr;if(2===a.Gc||8===a.Gc)d=e-1-d;return((a=2===a.Gc||4===a.Gc)?b.y<f.y:b.x<f.x)?c+8*d:(a?b.y===f.y:b.x===f.x)?c:c+8*(e-1-d)};Gp.className="Knot";function hq(a,b,c){this.link=a;this.angle=b;this.Gc=c;this.zw=new J;this.Em=this.Wq=0;this.dr=new J;this.cw=0}
hq.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.Gc.toString()+":"+this.Wq.toString()+"/"+this.Em.toString()+" "+this.dr.toString()+" "+this.cw.toString()+" "+this.zw.toString()};hq.className="LinkInfo";function rl(){this.Nh=this.nh=ld;this.Mh=this.mh=this.Lh=this.lh=NaN;this.vq=this.qo=null;this.wq=this.ro=Infinity}
rl.prototype.copy=function(){var a=new rl;a.nh=this.nh.J();a.Nh=this.Nh.J();a.lh=this.lh;a.Lh=this.Lh;a.mh=this.mh;a.Mh=this.Mh;a.qo=this.qo;a.vq=this.vq;a.ro=this.ro;a.wq=this.wq;return a};rl.className="LinkSettings";function Mi(){0<arguments.length&&za(Mi);fb(this);this.w=this.B=null;this.Ji=this.Go=!0;this.Lo=!1;this.zn=(new J(0,0)).freeze();this.Io=!0;this.Hn=this.Ho=null;this.Ko=!1;this.l=null;this.L=0;this.bp=this.Bq=null;this.Jt=!1;this.Kg=this.nk=null;this.yt=!1}
Mi.prototype.cloneProtected=function(a){a.Go=this.Go;a.Ji=this.Ji;a.Lo=this.Lo;a.zn.assign(this.zn);a.Io=this.Io;a.Ho=this.Ho;a.Hn=this.Hn;a.Ko=!0;a.bp=this.bp;a.Bq=this.Bq};Mi.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Mi.prototype.serializeLayoutProperties=function(a){a.arrangementOrigin={x:this.arrangementOrigin.x,y:this.arrangementOrigin.y};a.isRouting=this.isRouting};
Mi.prototype.deserializeLayoutProperties=function(a){null!==a&&(this.arrangementOrigin=new J(a.arrangementOrigin.x,a.arrangementOrigin.y),this.isRouting=a.isRouting)};Mi.prototype.nb=function(a){Ba(this,a)};Mi.prototype.toString=function(){var a=Pa(this.constructor);a+="(";null!==this.group&&(a+=" in "+this.group);null!==this.diagram&&(a+=" for "+this.diagram);return a+")"};
Mi.prototype.D=function(){if(this.isValidLayout){var a=this.diagram;if(null!==a&&!a.undoManager.isUndoingRedoing){var b=a.animationManager;!b.isTicking&&(b.defaultAnimation.isAnimating&&b.Tc(),this.isOngoing&&a.Aj||this.isInitial&&!a.Aj)&&(this.isValidLayout=!1,a.Jb())}}};Mi.prototype.createNetwork=function(){return new iq(this)};Mi.prototype.makeNetwork=function(a){var b=this.createNetwork();a instanceof Q?(b.Mg(a.nodes,!0),b.Mg(a.links,!0)):a instanceof Hf?b.Mg(a.memberParts):b.Mg(a.iterator);return b};
Mi.prototype.updateParts=function(){this.isValidLayout=!0;if(!this.workerLayout()){var a=this.diagram;if(null===a&&null!==this.network)for(var b=this.network.vertexes.iterator;b.next();){var c=b.value.node;if(null!==c&&(a=c.diagram,null!==a))break}try{null!==a&&a.Ca("Layout"),this.commitLayout()}finally{null!==a&&a.bb("Layout")}}};Mi.prototype.commitLayout=function(){if(null!==this.network){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();if(this.isRouting)for(a=this.network.edges.iterator;a.next();)a.value.commit()}};
Mi.prototype.doLayout=function(a){F&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");var b=new I;a instanceof Q?(jq(this,b,a.nodes,!0,this.bi,!0,!1,!0),jq(this,b,a.parts,!0,this.bi,!0,!1,!0)):a instanceof Hf?jq(this,b,a.memberParts,!1,this.bi,!0,!1,!0):b.addAll(a.iterator);0<b.count&&(a=this.diagram,null!==a&&a.Ca("Layout"),this.doMinimalNoNetworkLayout(b),null!==a&&a.bb("Layout"));this.isValidLayout=!0};
Mi.prototype.doMinimalNoNetworkLayout=function(a){var b=Math.ceil(Math.sqrt(a.count));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var c=this.arrangementOrigin.x,d=c,e=this.arrangementOrigin.y,f=0,g=0;for(a=a.iterator;a.next();){var h=a.value;kq(h);var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(d,e);h instanceof Hf&&(h.bi=!1);d+=Math.max(l,50)+20;g=Math.max(g,Math.max(k,50));f>=b-1?(f=0,d=c,e+=g+20,g=0):f++}};
Mi.prototype.doMinimalNetworkLayout=function(){var a=Math.ceil(Math.sqrt(this.network.vertexes.count));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);for(var b=this.arrangementOrigin.x,c=b,d=this.arrangementOrigin.y,e=0,f=0,g=this.network.vertexes.iterator;g.next();){var h=g.value.node;if(!(null===h||h instanceof R)&&(kq(h),this.bi(h))){var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(c,d);h instanceof Hf&&(h.bi=!1);c+=Math.max(l,50)+20;f=Math.max(f,Math.max(k,50));e>=a-1?(e=
0,c=b,d+=f+20,f=0):e++}}};Mi.prototype.bi=function(a){return!a.location.o()||a instanceof Hf&&a.bi?!0:!1};function jq(a,b,c,d,e,f,g,h){for(c=c.iterator;c.next();){var k=c.value;d&&!k.isTopLevel||null!==e&&!e(k)||!k.canLayout()||(f&&k instanceof U?k.isLinkLabel||(k instanceof Hf?null===k.layout?jq(a,b,k.memberParts,!1,e,f,g,h):(kq(k),b.add(k)):(kq(k),b.add(k))):g&&k instanceof R?b.add(k):!h||!k.bc()||k instanceof U||(kq(k),b.add(k)))}}
function kq(a){var b=a.actualBounds;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.Ya()}Mi.prototype.xj=function(a,b){var c=this.boundsComputation;if(null!==c)return b||(b=new L),c(a,this,b);if(!b)return a.actualBounds;b.set(a.actualBounds);return b};
Mi.prototype.oy=function(a){var b=new I;a instanceof Q?(jq(this,b,a.nodes,!0,null,!0,!0,!0),jq(this,b,a.links,!0,null,!0,!0,!0),jq(this,b,a.parts,!0,null,!0,!0,!0)):a instanceof Hf?jq(this,b,a.memberParts,!1,null,!0,!0,!0):jq(this,b,a.iterator,!1,null,!0,!0,!0);return b};
Mi.prototype.initialOrigin=function(a){var b=this.group;if(null!==b){var c=b.position.copy();(isNaN(c.x)||isNaN(c.y))&&c.set(a);b=b.placeholder;null!==b&&(c=b.ma(Hc),(isNaN(c.x)||isNaN(c.y))&&c.set(a),a=b.padding,c.x+=a.left,c.y+=a.top);return c}return a};Mi.prototype.mayUseWorker=function(){return this.mayUseWorkerFunction?this.mayUseWorkerFunction(this):!1};Mi.prototype.workerLayout=function(){return!1};
function lq(a,b){if(null!==a.workerStateChanged){var c={key:a.group?a.group.key:null};void 0!==b&&(c.time=b);null!==a.nk&&(c.running=mq(a.nk));null!==a.Kg&&(c.waiting=mq(a.Kg));a.workerStateChanged(c,a)}}function mq(a){return{vertexes:a.vertexes.count,edges:a.edges.count}}Mi.prototype.Lz=function(){var a=nq(this.constructor);a&&(null!==a.$e&&a.$e.terminate(),a.$e=null,a.Pm.iteratorValues.each(function(a){a.Jt=!1;a.nk=null;a.Kg=null;a.yt=!1;lq(a)}),a.Pm.clear())};
function oq(a,b){var c=nq(a);if(c){if(b)for(var d in b)c[d]=b[d]}else throw Error("Unknown Layout class: "+a);}function nq(a){var b=null;if("function"===typeof a){if(b=pq.get(a),!b){var c=Pa(a);b=pq.get(c);b||(b=new qq,b.Xv=a,b.name=c,b.l=a.name,b.Oy=rq,pq.set(c,b),pq.set(a,b),pq.set(a.name,b))}}else"string"===typeof a&&(b=pq.get(a));return b}
Mi.prototype.ix=function(){if("undefined"===typeof Worker||!sq||"undefined"===typeof self||"undefined"!==typeof self.DedicatedWorkerGlobalScope)return!1;if(!this.mayUseWorker())return this.Jt&&(this.yt=!0,this.Kg=this.nk=null,lq(this)),!1;var a=nq(this.constructor);if(null===a)return!1;null===a.$e&&(a.$e=new Worker(sq),a.$e.onerror=function(a){a.preventDefault();Ca("Worker Error at: "+a.filename+" "+a.lineno+" "+a.colno+"\n  "+a.message)},a.$e.l=function(a){Ca("Worker serialization error: "+a)},a.$e.onmessage=
function(b){var c=b.data;if("_GoJS"===c._GoJS)if(c.version)Ca("GoJS v"+Q.version+"  Worker v"+c.version);else if(b=a.Pm.get(c.id)){a.Pm.remove(c.id);b.Jt=!1;b.nk=null;if(b.yt)b.yt=!1,b.Kg=null;else{var d=tq(b,c,!1);b.network=d;b.updateParts();b.network=null;b.isValidLayout=!0}lq(b,c.time);c=b.Kg;if(null!==c)b.Kg=null;else for(d=a.Pm.iteratorValues;d.next();){var e=d.value;c=e.Kg;if(null!==c){e.Kg=null;break}}null!==c&&uq(b,c)}},a.$e.postMessage({_GoJS:"_GoJS",url:a.Oy}),Array.isArray(a.scripts)&&
a.scripts.forEach(function(b){a.$e.postMessage({_GoJS:"_GoJS",url:b})}),a.$e.postMessage({_GoJS:"_GoJS",version:-1}));null!==this.nk?this.Kg=this.network:uq(this,this.network);lq(this);this.doMinimalNetworkLayout();this.network=null;return this.isValidLayout=!0};function uq(a,b){a.Jt=!0;var c=nq(a.constructor),d=vq(a,b,!0);d._GoJS="_GoJS";c.$e.postMessage(d);c.Pm.set(pb(a),a);a.nk=b}
function vq(a,b,c){a.onNetworkSerialization(1,c,b,null);var d={};a.serializeLayoutProperties(d,c);var e=[];b.vertexes.each(function(a){var b={};a.serializeVertexProperties(b,c);e.push(b)});var f=[];b.edges.each(function(a){var b={};a.serializeEdgeProperties(b,c);f.push(b)});d={id:c?pb(a):a.id,layout:Pa(a.constructor),p:d,wB:e,eA:f};a.onNetworkSerialization(2,c,b,d);return d}
function tq(a,b,c){c&&(a.id=b.id);var d=a.diagram,e=a.createNetwork();a.onNetworkSerialization(3,c,e,b);var f=b.wB,g=new Db;f&&f.forEach(function(a){var b=null;null===a.key||null===d||c||(b=d.Hb(a.key));null!==b?b=e.wk(b):(b=e.createVertex(),null!==a.key&&(b.data=b),e.Ng(b));c&&null!==b.data&&(b.data.Ni=a.key);g.set(a.id,b)});var h=b.eA,k=new Db;h&&h.forEach(function(a){var b=null;null===a.key||null===d||c||(b=d.findLinkForKey(a.key));null!==b?b=e.jy(b):(b=e.createEdge(),null!==a.key&&(b.data=b),
e.Am(b));c&&null!==b.data&&(b.data.Ni=a.key);k.set(a.id,b)});a.deserializeLayoutProperties(b.p,g,k,c);f&&f.forEach(function(a){var b=g.get(a.id);b&&b.Nq(a,g,k,c)});h&&h.forEach(function(a){var b=k.get(a.id);b&&b.deserializeEdgeProperties(a,g,k,c)});a.onNetworkSerialization(4,c,e,b);return e}Mi.prototype.onNetworkSerialization=function(){};
ma.Object.defineProperties(Mi.prototype,{diagram:{configurable:!0,get:function(){return this.B},set:function(a){null!==a&&x(a,Q,Mi,"diagram");this.B=a}},group:{configurable:!0,get:function(){return this.w},set:function(a){this.w!==a&&(null!==a&&x(a,Hf,Mi,"group"),this.w=a,null!==a&&(this.B=a.diagram))}},isOngoing:{configurable:!0,get:function(){return this.Go},set:function(a){this.Go!==a&&(A(a,"boolean",Mi,"isOngoing"),this.Go=a)}},isInitial:{configurable:!0,
enumerable:!0,get:function(){return this.Ji},set:function(a){A(a,"boolean",Mi,"isInitial");this.Ji=a;a||(this.Ko=!0)}},isViewportSized:{configurable:!0,get:function(){return this.Lo},set:function(a){this.Lo!==a&&(A(a,"boolean",Mi,"isViewportSized"),(this.Lo=a)&&this.D())}},isRouting:{configurable:!0,get:function(){return this.Io},set:function(a){this.Io!==a&&(A(a,"boolean",Mi,"isRouting"),this.Io=a)}},isRealtime:{configurable:!0,get:function(){return this.Ho},
set:function(a){this.Ho!==a&&(null!==a&&A(a,"boolean",Mi,"isRealtime"),this.Ho=a)}},isValidLayout:{configurable:!0,get:function(){return this.Ko},set:function(a){this.Ko!==a&&(A(a,"boolean",Mi,"isValidLayout"),this.Ko=a,a||(a=this.diagram,null!==a&&(a.Zg=!0)))}},network:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(null!==a&&x(a,iq,Mi,"network"),this.l=a,null!==a&&(a.layout=this))}},boundsComputation:{configurable:!0,get:function(){return this.Hn},
set:function(a){this.Hn!==a&&(null!==a&&A(a,"function",Mi,"boundsComputation"),this.Hn=a,this.D())}},arrangementOrigin:{configurable:!0,get:function(){return this.zn},set:function(a){x(a,J,Mi,"arrangementOrigin");this.zn.A(a)||(this.zn.assign(a),this.D())}},id:{configurable:!0,get:function(){return this.L},set:function(a){this.L=a}},mayUseWorkerFunction:{configurable:!0,get:function(){return this.bp},set:function(a){this.bp!==a&&(null!==a&&A(a,"function",
Mi,"mayUseWorkerFunction"),this.bp=a)}},workerStateChanged:{configurable:!0,get:function(){return this.Bq},set:function(a){this.Bq!==a&&(null!==a&&A(a,"function",Mi,"workerStateChanged"),this.Bq=a)}}});Mi.prototype.useWorker=Mi.prototype.ix;Mi.declareWorkerLayout=oq;Mi.prototype.cancelWorker=Mi.prototype.Lz;Mi.prototype.collectParts=Mi.prototype.oy;Mi.prototype.getLayoutBounds=Mi.prototype.xj;Mi.prototype.invalidateLayout=Mi.prototype.D;
var pq=new Db,rq="object"===typeof qa.document&&qa.document.currentScript?qa.document.currentScript.src:"",sq="undefined"!==typeof URL&&"function"===typeof URL.createObjectURL&&"function"===typeof Blob?URL.createObjectURL(new Blob(["self.onmessage=function(e){if(e.data.url){\nimportScripts(e.data.url);}}"],{type:"text/javascript"})):"";Mi.className="Layout";Mi.GoJSScriptURL=rq;Mi.declareWorkerLayout=oq;
"undefined"!==typeof self&&"undefined"!==typeof self.DedicatedWorkerGlobalScope&&"undefined"!==typeof self&&"undefined"!==typeof self.DedicatedWorkerGlobalScope&&(self.onmessage=function(a){a=a.data;if("_GoJS"===a._GoJS)if(a.url)importScripts(a.url);else if(a.version)self.postMessage({_GoJS:"_GoJS",version:Q.version},void 0);else{var b=performance.now(),c=null;a.layout&&(c=nq(a.layout));var d=null;c&&c.Xv&&(d=new c.Xv);if(!d)throw Error("no registered Worker Layout: "+a.layout);d.network=tq(d,a,!0);
d.workerLayout=function(){var a=vq(d,d.network,!1);a._GoJS="_GoJS";a.time=performance.now()-b;self.postMessage(a,void 0);return!0};d.doLayout(new H)}});function qq(){this.Xv=null;this.Oy=this.l=this.name="";this.scripts=[];this.$e=null;this.Pm=new Db}function iq(a){fb(this);F&&!a&&v("LayoutNetwork constructor requires non-null Layout argument");this.qc=a;this.Ff=new I;this.re=new I;this.nu=new Db;this.iu=new Db}
iq.prototype.clear=function(){if(this.Ff)for(var a=this.Ff.iterator;a.next();)a.value.clear();if(this.re)for(a=this.re.iterator;a.next();)a.value.clear();this.Ff=new I;this.re=new I;this.nu=new Db;this.iu=new Db};
iq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutNetwork"+(null!==this.layout?"("+this.layout.toString()+")":"");if(0>=a)return b;b+=" vertexes: "+this.Ff.count+" edges: "+this.re.count;if(1<a){for(var c=this.Ff.iterator;c.next();)b+="\n    "+c.value.toString(a-1);for(c=this.re.iterator;c.next();)b+="\n    "+c.value.toString(a-1)}return b};iq.prototype.createVertex=function(){return new wq(this)};iq.prototype.createEdge=function(){return new xq(this)};
iq.prototype.Mg=function(a,b,c){if(null!==a){void 0===b&&(b=!1);A(b,"boolean",iq,"addParts:toplevelonly");void 0===c&&(c=null);null===c&&(c=function(a){if(a instanceof U)return!a.isLinkLabel;if(a instanceof R){var b=a.fromNode;if(null===b||b.isLinkLabel)return!1;a=a.toNode;return null===a||a.isLinkLabel?!1:!0}return!1});for(a=a.iterator;a.next();){var d=a.value;if(d instanceof U&&(!b||d.isTopLevel)&&d.canLayout()&&c(d))if(d instanceof Hf&&null===d.layout)this.Mg(d.memberParts,!1);else if(null===this.vj(d)){var e=
this.createVertex();e.node=d;this.Ng(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof R&&(!b||d.isTopLevel)&&d.canLayout()&&c(d)&&null===this.Pq(d)){var f=d.fromNode;e=d.toNode;null!==f&&null!==e&&f!==e&&(f=this.findGroupVertex(f),e=this.findGroupVertex(e),null!==f&&null!==e&&this.Lk(f,e,d))}}};
iq.prototype.findGroupVertex=function(a){if(null===a)return null;var b=a.findVisibleNode();if(null===b)return null;a=this.vj(b);if(null!==a)return a;for(b=b.containingGroup;null!==b;){a=this.vj(b);if(null!==a)return a;b=b.containingGroup}return null};t=iq.prototype;t.Ng=function(a){if(null!==a){F&&x(a,wq,iq,"addVertex:vertex");this.Ff.add(a);var b=a.node;null!==b&&this.nu.add(b,a);a.network=this}};
t.wk=function(a){if(null===a)return null;F&&x(a,U,iq,"addNode:node");var b=this.vj(a);null===b&&(b=this.createVertex(),b.node=a,this.Ng(b));return b};t.$v=function(a){if(null!==a&&(F&&x(a,wq,iq,"deleteVertex:vertex"),yq(this,a))){for(var b=a.Ye,c=b.count-1;0<=c;c--){var d=b.O(c);this.Ek(d)}b=a.Re;for(a=b.count-1;0<=a;a--)c=b.O(a),this.Ek(c)}};function yq(a,b){if(null===b)return!1;var c=a.Ff.remove(b);c&&(b=b.node,null!==b&&a.nu.remove(b));return c}
t.Xz=function(a){null!==a&&(F&&x(a,U,iq,"deleteNode:node"),a=this.vj(a),null!==a&&this.$v(a))};t.vj=function(a){if(null===a)return null;F&&x(a,U,iq,"findVertex:node");return this.nu.K(a)};t.Am=function(a){if(null!==a){F&&x(a,xq,iq,"addEdge:edge");zq(this,a);var b=a.toVertex;null!==b&&b.Rv(a);b=a.fromVertex;null!==b&&b.Pv(a)}};function zq(a,b){if(null!==b){a.re.add(b);var c=b.link;null!==c&&null===a.Pq(c)&&a.iu.add(c,b);b.network=a}}
t.jy=function(a){if(null===a)return null;F&&x(a,R,iq,"addLink:link");var b=a.fromNode,c=a.toNode,d=this.Pq(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.wk(b)),null!==c&&(d.toVertex=this.wk(c)),this.Am(d)):(null!==b?d.fromVertex=this.wk(b):d.fromVertex=null,null!==c?d.toVertex=this.wk(c):d.toVertex=null);return d};t.Ek=function(a){if(null!==a){F&&x(a,xq,iq,"deleteEdge:edge");var b=a.toVertex;null!==b&&b.Zv(a);b=a.fromVertex;null!==b&&b.Yv(a);Aq(this,a)}};
function Aq(a,b){null!==b&&a.re.remove(b)&&(b=b.link,null!==b&&a.iu.remove(b))}t.Wz=function(a){null!==a&&(F&&x(a,R,iq,"deleteLink:link"),a=this.Pq(a),null!==a&&this.Ek(a))};t.Pq=function(a){if(null===a)return null;F&&x(a,R,iq,"findEdge:link");return this.iu.K(a)};
t.Lk=function(a,b,c){if(null===a||null===b)return null;F&&(x(a,wq,iq,"linkVertexes:fromVertex"),x(b,wq,iq,"linkVertexes:toVertex"),null!==c&&x(c,R,iq,"linkVertexes:link"));if(a.network===this&&b.network===this){var d=this.createEdge();d.link=c;d.fromVertex=a;d.toVertex=b;this.Am(d);return d}return null};t.dn=function(a){if(null!==a){F&&x(a,xq,iq,"reverseEdge:edge");var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.Yv(a),c.Zv(a),a.dn(),b.Rv(a),c.Pv(a))}};
t.Mq=function(){for(var a=La(),b=this.re.iterator;b.next();){var c=b.value;c.fromVertex===c.toVertex&&a.push(c)}b=a.length;for(c=0;c<b;c++)this.Ek(a[c]);Oa(a)};iq.prototype.deleteArtificialVertexes=function(){for(var a=La(),b=this.Ff.iterator;b.next();){var c=b.value;null===c.node&&null===c.data&&a.push(c)}c=a.length;for(b=0;b<c;b++)this.$v(a[b]);b=La();for(c=this.re.iterator;c.next();){var d=c.value;null===d.link&&null===d.data&&b.push(d)}c=b.length;for(d=0;d<c;d++)this.Ek(b[d]);Oa(a);Oa(b)};
function Bq(a){for(var b=La(),c=a.re.iterator;c.next();){var d=c.value;null!==d.fromVertex&&null!==d.toVertex||b.push(d)}c=b.length;for(d=0;d<c;d++)a.Ek(b[d]);Oa(b)}
iq.prototype.jz=function(a){void 0===a&&(a=!0);a&&(this.deleteArtificialVertexes(),Bq(this),this.Mq());a=new H;for(var b=!0;b;){b=!1;for(var c=this.Ff.iterator;c.next();){var d=c.value;if(0<d.Ye.count||0<d.Re.count){b=this.layout.createNetwork();a.add(b);Cq(this,b,d);b=!0;break}}}a.sort(function(a,b){return null===a||null===b||a===b?0:b.vertexes.count-a.vertexes.count});return a};
function Cq(a,b,c){if(null!==c&&c.network!==b){yq(a,c);b.Ng(c);for(var d=c.sourceEdges;d.next();){var e=d.value;e.network!==b&&(Aq(a,e),zq(b,e),Cq(a,b,e.fromVertex))}for(d=c.destinationEdges;d.next();)c=d.value,c.network!==b&&(Aq(a,c),zq(b,c),Cq(a,b,c.toVertex))}}iq.prototype.fA=function(){for(var a=new I,b=this.Ff.iterator;b.next();)a.add(b.value.node);for(b=this.re.iterator;b.next();)a.add(b.value.link);return a};
ma.Object.defineProperties(iq.prototype,{layout:{configurable:!0,get:function(){return this.qc},set:function(a){null!==a&&(this.qc=a)}},vertexes:{configurable:!0,get:function(){return this.Ff}},edges:{configurable:!0,get:function(){return this.re}}});iq.prototype.findAllParts=iq.prototype.fA;iq.prototype.splitIntoSubNetworks=iq.prototype.jz;iq.prototype.deleteSelfEdges=iq.prototype.Mq;iq.prototype.reverseEdge=iq.prototype.dn;iq.prototype.linkVertexes=iq.prototype.Lk;
iq.prototype.findEdge=iq.prototype.Pq;iq.prototype.deleteLink=iq.prototype.Wz;iq.prototype.deleteEdge=iq.prototype.Ek;iq.prototype.addLink=iq.prototype.jy;iq.prototype.addEdge=iq.prototype.Am;iq.prototype.findVertex=iq.prototype.vj;iq.prototype.deleteNode=iq.prototype.Xz;iq.prototype.deleteVertex=iq.prototype.$v;iq.prototype.addNode=iq.prototype.wk;iq.prototype.addVertex=iq.prototype.Ng;iq.prototype.addParts=iq.prototype.Mg;iq.className="LayoutNetwork";
function wq(a){fb(this);F&&!a&&v("LayoutVertex constructor requires non-null LayoutNetwork argument");this.Wc=a;this.l=(new L(0,0,10,10)).freeze();this.w=(new J(5,5)).freeze();this.Wi=this.qb=null;this.Ye=new H;this.Re=new H}
wq.prototype.serializeVertexProperties=function(a){a.id=pb(this);a.key=this.node?this.node.key:this.data?this.data.Ni:void 0;void 0===a.key&&(a.key=null);a.x=this.bounds.x;a.y=this.bounds.y;a.xB=this.bounds.width;a.IA=this.bounds.height;a.fx=this.focus.x;a.fy=this.focus.y;var b=[];this.Ye.each(function(a){b.push(pb(a))});a.gz=b;var c=[];this.Re.each(function(a){c.push(pb(a))});a.vy=c};
wq.prototype.Nq=function(a,b,c){if(null!==a){this.x=a.x;this.y=a.y;this.width=a.xB;this.height=a.IA;this.focusX=a.fx;this.focusY=a.fy;var d=this;a.gz&&a.gz.forEach(function(a){(a=c.get(a))&&d.Ye.add(a)});a.vy&&a.vy.forEach(function(a){(a=c.get(a))&&d.Re.add(a)})}};wq.prototype.clear=function(){this.Wi=this.qb=null;this.Ye=new H;this.Re=new H};
wq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+pb(this);if(0<a&&(b+=null!==this.node?"("+this.node.toString()+")":"",1<a)){a="";for(var c=!0,d=this.Ye.iterator;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.Re.iterator;d.next();){var f=d.value;c?c=!1:e+=",";e+=f.toString(0)}b+=" sources: "+a+" destinations: "+e}return b};
wq.prototype.commit=function(){var a=this.qb;if(null!==a){var b=this.bounds,c=a.bounds;Fa(c)?(c.x=b.x,c.y=b.y,c.width=b.width,c.height=b.height):a.bounds=b.copy()}else if(a=this.node,null!==a){b=this.bounds;if(!(a instanceof Hf)){c=L.alloc();var d=this.network.layout.xj(a,c),e=a.locationObject.ma(Mc);if(d.o()&&e.o()){a.moveTo(b.x+this.focusX-(e.x-d.x),b.y+this.focusY-(e.y-d.y));L.free(c);return}L.free(c)}a.moveTo(b.x,b.y)}};
wq.prototype.Rv=function(a){null!==a&&(F&&x(a,xq,wq,"addSourceEdge:edge"),this.Ye.contains(a)||this.Ye.add(a))};wq.prototype.Zv=function(a){null!==a&&(F&&x(a,xq,wq,"deleteSourceEdge:edge"),this.Ye.remove(a))};wq.prototype.Pv=function(a){null!==a&&(F&&x(a,xq,wq,"addDestinationEdge:edge"),this.Re.contains(a)||this.Re.add(a))};wq.prototype.Yv=function(a){null!==a&&(F&&x(a,xq,wq,"deleteDestinationEdge:edge"),this.Re.remove(a))};
function Dq(a,b){F&&x(a,wq,wq,"standardComparer:m");F&&x(b,wq,wq,"standardComparer:n");a=a.Wi;b=b.Wi;return a?b?(a=a.text,b=b.text,a<b?-1:a>b?1:0):1:null!==b?-1:0}
ma.Object.defineProperties(wq.prototype,{sourceEdgesArrayAccess:{configurable:!0,get:function(){return this.Ye._dataArray}},destinationEdgesArrayAccess:{configurable:!0,get:function(){return this.Re._dataArray}},data:{configurable:!0,get:function(){return this.qb},set:function(a){this.qb=a;if(null!==a&&a.bounds){var b=a.bounds;a=b.x;var c=b.y,d=b.width;b=b.height;this.w.h(d/2,b/2);this.l.h(a,c,d,b)}}},node:{configurable:!0,get:function(){return this.Wi},
set:function(a){if(this.Wi!==a){F&&null!==a&&x(a,U,wq,"node");this.Wi=a;a.Ya();var b=this.network.layout,c=L.alloc(),d=b.xj(a,c);b=d.x;var e=d.y,f=d.width;d=d.height;isNaN(b)&&(b=0);isNaN(e)&&(e=0);this.l.h(b,e,f,d);L.free(c);if(!(a instanceof Hf)&&(a=a.locationObject.ma(Mc),a.o())){this.w.h(a.x-b,a.y-e);return}this.w.h(f/2,d/2)}}},bounds:{configurable:!0,get:function(){return this.l},set:function(a){this.l.A(a)||(F&&x(a,L,wq,"bounds"),this.l.assign(a))}},focus:{configurable:!0,
get:function(){return this.w},set:function(a){this.w.A(a)||(F&&x(a,J,wq,"focus"),this.w.assign(a))}},centerX:{configurable:!0,get:function(){return this.l.x+this.w.x},set:function(a){var b=this.l;b.x+this.w.x!==a&&(F&&C(a,wq,"centerX"),b.ka(),b.x=a-this.w.x,b.freeze())}},centerY:{configurable:!0,get:function(){return this.l.y+this.w.y},set:function(a){var b=this.l;b.y+this.w.y!==a&&(F&&C(a,wq,"centerY"),b.ka(),b.y=a-this.w.y,b.freeze())}},focusX:{configurable:!0,
get:function(){return this.w.x},set:function(a){var b=this.w;b.x!==a&&(b.ka(),b.x=a,b.freeze())}},focusY:{configurable:!0,get:function(){return this.w.y},set:function(a){var b=this.w;b.y!==a&&(b.ka(),b.y=a,b.freeze())}},x:{configurable:!0,get:function(){return this.l.x},set:function(a){var b=this.l;b.x!==a&&(b.ka(),b.x=a,b.freeze())}},y:{configurable:!0,get:function(){return this.l.y},set:function(a){var b=this.l;b.y!==a&&(b.ka(),b.y=a,b.freeze())}},width:{configurable:!0,
enumerable:!0,get:function(){return this.l.width},set:function(a){var b=this.l;b.width!==a&&(b.ka(),b.width=a,b.freeze())}},height:{configurable:!0,get:function(){return this.l.height},set:function(a){var b=this.l;b.height!==a&&(b.ka(),b.height=a,b.freeze())}},network:{configurable:!0,get:function(){return this.Wc},set:function(a){F&&x(a,iq,wq,"network");this.Wc=a}},sourceVertexes:{configurable:!0,get:function(){for(var a=new I,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);
return a.iterator}},destinationVertexes:{configurable:!0,get:function(){for(var a=new I,b=this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},vertexes:{configurable:!0,get:function(){for(var a=new I,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);for(b=this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},sourceEdges:{configurable:!0,get:function(){return this.Ye.iterator}},destinationEdges:{configurable:!0,
enumerable:!0,get:function(){return this.Re.iterator}},edges:{configurable:!0,get:function(){for(var a=new H,b=this.sourceEdges;b.next();)a.add(b.value);for(b=this.destinationEdges;b.next();)a.add(b.value);return a.iterator}},edgesCount:{configurable:!0,get:function(){return this.Ye.count+this.Re.count}}});wq.prototype.deleteDestinationEdge=wq.prototype.Yv;wq.prototype.addDestinationEdge=wq.prototype.Pv;wq.prototype.deleteSourceEdge=wq.prototype.Zv;
wq.prototype.addSourceEdge=wq.prototype.Rv;wq.className="LayoutVertex";wq.standardComparer=Dq;
wq.smartComparer=function(a,b){F&&x(a,wq,wq,"smartComparer:m");F&&x(b,wq,wq,"smartComparer:n");if(null!==a){if(null!==b){a=a.Wi;var c=b.Wi;if(null!==a){if(null!==c){b=a.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);a=c.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);for(c=0;c<b.length;c++)if(""!==a[c]&&void 0!==a[c]){var d=parseFloat(b[c]),e=parseFloat(a[c]);if(isNaN(d))if(isNaN(e)){if(0!==b[c].localeCompare(a[c]))return b[c].localeCompare(a[c])}else return 1;
else{if(isNaN(e))return-1;if(0!==d-e)return d-e}}else if(""!==b[c])return 1;return""!==a[c]&&void 0!==a[c]?-1:0}return 1}return null!==c?-1:0}return 1}return null!==b?-1:0};function xq(a){fb(this);F&&!a&&v("LayoutEdge constructor requires non-null LayoutNetwork argument");this.Vc=a;this.Hg=this.hg=this.Ul=this.qb=null}xq.prototype.clear=function(){this.Hg=this.hg=this.Ul=this.qb=null};
xq.prototype.serializeEdgeProperties=function(a){a.id=pb(this);a.key=this.link?this.link.key:this.data?this.data.Ni:void 0;void 0===a.key&&(a.key=null);a.from=this.fromVertex?pb(this.fromVertex):null;a.sB=this.toVertex?pb(this.toVertex):null};xq.prototype.deserializeEdgeProperties=function(a,b){if(null!==a){var c=b.get(a.from);c&&(this.fromVertex=c);if(a=b.get(a.sB))this.toVertex=a}};
xq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+pb(this);0<a&&(b+=null!==this.Ul?"("+this.Ul.toString()+")":"",1<a&&(b+=" "+(this.hg?this.hg.toString():"null")+" --\x3e "+(this.Hg?this.Hg.toString():"null")));return b};xq.prototype.dn=function(){var a=this.hg;this.hg=this.Hg;this.Hg=a};xq.prototype.commit=function(){};xq.prototype.Ly=function(a){F&&x(a,wq,xq,"getOtherVertex:v");return this.Hg===a?this.hg:this.hg===a?this.Hg:null};
ma.Object.defineProperties(xq.prototype,{network:{configurable:!0,get:function(){return this.Vc},set:function(a){F&&x(a,iq,xq,"network");this.Vc=a}},data:{configurable:!0,get:function(){return this.qb},set:function(a){this.qb!==a&&(F&&null!==a&&A(a,"object",xq,"data"),this.qb=a)}},link:{configurable:!0,get:function(){return this.Ul},set:function(a){this.Ul!==a&&(F&&null!==a&&x(a,R,xq,"link"),this.Ul=a)}},fromVertex:{configurable:!0,get:function(){return this.hg},
set:function(a){this.hg!==a&&(F&&null!==a&&x(a,wq,xq,"network"),this.hg=a)}},toVertex:{configurable:!0,get:function(){return this.Hg},set:function(a){this.Hg!==a&&(F&&null!==a&&x(a,wq,xq,"network"),this.Hg=a)}}});xq.prototype.getOtherVertex=xq.prototype.Ly;xq.className="LayoutEdge";
function $k(){0<arguments.length&&za($k);Mi.call(this);this.isViewportSized=!0;this.Cq=this.Dq=NaN;this.bh=(new Hb(NaN,NaN)).freeze();this.xf=(new Hb(10,10)).freeze();this.Db=Eq;this.Kb=Fq;this.dd=Gq;this.Zc=Hq}la($k,Mi);$k.prototype.cloneProtected=function(a){Mi.prototype.cloneProtected.call(this,a);a.Dq=this.Dq;a.Cq=this.Cq;a.bh.assign(this.bh);a.xf.assign(this.xf);a.Db=this.Db;a.Kb=this.Kb;a.dd=this.dd;a.Zc=this.Zc};
$k.prototype.nb=function(a){a.classType===$k?a===Gq||a===Iq||a===Jq||a===Kq?this.sorting=a:a===Fq||a===Lq?this.arrangement=a:a===Eq||a===Mq?this.alignment=a:v("Unknown enum value: "+a):Mi.prototype.nb.call(this,a)};
$k.prototype.doLayout=function(a){F&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var b=this.oy(a);a=this.diagram;for(var c=b.copy().iterator;c.next();){var d=c.value;if(!d.$h()||null===d.fromNode&&null===d.toNode){if(d.Ya(),d instanceof Hf)for(d=d.memberParts;d.next();)b.remove(d.value)}else b.remove(d)}var e=b.ta();if(0!==e.length){switch(this.sorting){case Kq:e.reverse();
break;case Gq:e.sort(this.comparer);break;case Iq:e.sort(this.comparer),e.reverse()}var f=this.wrappingColumn;isNaN(f)&&(f=0);var g=this.wrappingWidth;isNaN(g)&&null!==a?(b=a.padding,g=Math.max(a.viewportBounds.width-b.left-b.right,0)):g=Math.max(this.wrappingWidth,0);0>=f&&0>=g&&(f=1);b=this.spacing.width;isFinite(b)||(b=0);c=this.spacing.height;isFinite(c)||(c=0);null!==a&&a.Ca("Layout");d=[];switch(this.alignment){case Mq:var h=b,k=c,l=L.alloc(),m=Math.max(this.cellSize.width,1);if(!isFinite(m))for(var n=
m=0;n<e.length;n++){var p=this.xj(e[n],l);m=Math.max(m,p.width)}m=Math.max(m+h,1);n=Math.max(this.cellSize.height,1);if(!isFinite(n))for(p=n=0;p<e.length;p++){var r=this.xj(e[p],l);n=Math.max(n,r.height)}n=Math.max(n+k,1);p=this.arrangement;for(var q=r=this.arrangementOrigin.x,u=this.arrangementOrigin.y,w=0,y=0,z=0;z<e.length;z++){var B=e[z],D=this.xj(B,l),G=Math.ceil((D.width+h)/m)*m,O=Math.ceil((D.height+k)/n)*n;switch(p){case Lq:var T=Math.abs(q-D.width);break;default:T=q+D.width}if(0<f&&w>f-1||
0<g&&0<w&&T-r>g)d.push(new L(0,u,g+h,y)),w=0,q=r,u+=y,y=0;y=Math.max(y,O);switch(p){case Lq:D=-D.width;break;default:D=0}B.moveTo(q+D,u);switch(p){case Lq:q-=G;break;default:q+=G}w++}d.push(new L(0,u,g+h,y));L.free(l);break;case Eq:k=g;m=f;n=b;p=c;g=L.alloc();r=Math.max(this.cellSize.width,1);f=u=l=0;h=J.alloc();for(q=0;q<e.length;q++)y=e[q],w=this.xj(y,g),y=y.Of(y.locationObject,y.locationSpot,h),l=Math.max(l,y.x),u=Math.max(u,w.width-y.x),f=Math.max(f,y.y);q=this.arrangement;switch(q){case Lq:l+=
n;break;default:u+=n}r=isFinite(r)?Math.max(r+n,1):Math.max(l+u,1);var P=y=this.arrangementOrigin.x;z=this.arrangementOrigin.y;u=0;k>=l&&(k-=l);l=B=0;G=Math.max(this.cellSize.height,1);D=f=0;O=!0;w=J.alloc();for(T=0;T<e.length;T++){var ba=e[T],Y=this.xj(ba,g),oa=ba.Of(ba.locationObject,ba.locationSpot,h);if(0<u)switch(q){case Lq:P=(P-y-(Y.width-oa.x))/r;P=K.ca(Math.round(P),P)?Math.round(P):Math.floor(P);P=P*r+y;break;default:P=(P-y+oa.x)/r,P=K.ca(Math.round(P),P)?Math.round(P):Math.ceil(P),P=P*r+
y}else switch(q){case Lq:B=P+oa.x+Y.width;break;default:B=P-oa.x}switch(q){case Lq:var Ea=-(P+oa.x)+B;break;default:Ea=P+Y.width-oa.x-B}if(0<m&&u>m-1||0<k&&0<u&&Ea>k){d.push(new L(0,O?z-f:z,k+n,D+f+p));for(P=0;P<u&&T!==u;P++){Ea=e[T-u+P];var X=Ea.Of(Ea.locationObject,Ea.locationSpot,w);Ea.moveTo(Ea.position.x,Ea.position.y+f-X.y)}D+=p;z=O?z+D:z+(D+f);u=D=f=0;P=y;O=!1}P===y&&(l=q===Lq?Math.max(l,Y.width-oa.x):Math.min(l,-oa.x));f=Math.max(f,oa.y);D=Math.max(D,Y.height-oa.y);isFinite(G)&&(D=Math.max(D,
Math.max(Y.height,G)-oa.y));O?ba.moveTo(P-oa.x,z-oa.y):ba.moveTo(P-oa.x,z);switch(q){case Lq:P-=oa.x+n;break;default:P+=Y.width-oa.x+n}u++}d.push(new L(0,z,k+n,(O?D:D+f)+p));if(e.length!==u)for(k=0;k<u;k++)m=e[e.length-u+k],n=m.Of(m.locationObject,m.locationSpot,h),m.moveTo(m.position.x,m.position.y+f-n.y);J.free(h);J.free(w);if(q===Lq)for(e=0;e<d.length;e++)f=d[e],f.width+=l,f.x-=l;else for(e=0;e<d.length;e++)f=d[e],f.x>l&&(f.width+=f.x-l,f.x=l);L.free(g)}for(h=f=g=e=0;h<d.length;h++)k=d[h],e=Math.min(e,
k.x),g=Math.min(g,k.y),f=Math.max(f,k.x+k.width);this.arrangement===Lq?this.commitLayers(d,new J(e+b/2-(f+e),g-c/2)):this.commitLayers(d,new J(e-b/2,g-c/2));null!==a&&a.bb("Layout");this.isValidLayout=!0}};$k.prototype.commitLayers=function(){};function Hq(a,b){F&&x(a,S,$k,"standardComparer:a");F&&x(b,S,$k,"standardComparer:b");a=a.text;b=b.text;return a<b?-1:a>b?1:0}
ma.Object.defineProperties($k.prototype,{wrappingWidth:{configurable:!0,get:function(){return this.Dq},set:function(a){this.Dq!==a&&(A(a,"number",$k,"wrappingWidth"),0<a||isNaN(a))&&(this.Dq=a,this.isViewportSized=isNaN(a),this.D())}},wrappingColumn:{configurable:!0,get:function(){return this.Cq},set:function(a){this.Cq!==a&&(A(a,"number",$k,"wrappingColumn"),0<a||isNaN(a))&&(this.Cq=a,this.D())}},cellSize:{configurable:!0,get:function(){return this.bh},set:function(a){x(a,
Hb,$k,"cellSize");this.bh.A(a)||(this.bh.assign(a),this.D())}},spacing:{configurable:!0,get:function(){return this.xf},set:function(a){x(a,Hb,$k,"spacing");this.xf.A(a)||(this.xf.assign(a),this.D())}},alignment:{configurable:!0,get:function(){return this.Db},set:function(a){this.Db!==a&&(hb(a,$k,$k,"alignment"),a===Eq||a===Mq)&&(this.Db=a,this.D())}},arrangement:{configurable:!0,get:function(){return this.Kb},set:function(a){this.Kb!==a&&(hb(a,$k,$k,"arrangement"),
a===Fq||a===Lq)&&(this.Kb=a,this.D())}},sorting:{configurable:!0,get:function(){return this.dd},set:function(a){this.dd!==a&&(hb(a,$k,$k,"sorting"),a===Jq||a===Kq||a===Gq||a===Iq)&&(this.dd=a,this.D())}},comparer:{configurable:!0,get:function(){return this.Zc},set:function(a){this.Zc!==a&&(A(a,"function",$k,"comparer"),this.Zc=a,this.D())}}});
var Mq=new E($k,"Position",0),Eq=new E($k,"Location",1),Fq=new E($k,"LeftToRight",2),Lq=new E($k,"RightToLeft",3),Jq=new E($k,"Forward",4),Kq=new E($k,"Reverse",5),Gq=new E($k,"Ascending",6),Iq=new E($k,"Descending",7);$k.className="GridLayout";$k.standardComparer=Hq;
$k.smartComparer=function(a,b){F&&x(a,S,$k,"standardComparer:a");F&&x(b,S,$k,"standardComparer:b");if(null!==a){if(null!==b){a=a.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);b=b.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);for(var c=0;c<a.length;c++)if(""!==b[c]&&void 0!==b[c]){var d=parseFloat(a[c]),e=parseFloat(b[c]);if(isNaN(d))if(isNaN(e)){if(0!==a[c].localeCompare(b[c]))return a[c].localeCompare(b[c])}else return 1;else{if(isNaN(e))return-1;
if(0!==d-e)return d-e}}else if(""!==a[c])return 1;return""!==b[c]&&void 0!==b[c]?-1:0}return 1}return null!==b?-1:0};$k.Position=Mq;$k.Location=Eq;$k.LeftToRight=Fq;$k.RightToLeft=Lq;$k.Forward=Jq;$k.Reverse=Kq;$k.Ascending=Gq;$k.Descending=Iq;function Hi(){this.vp=new I;this.Wo=new I;this.Ia=new I;this.ef=new Db;this.df=new Db;this.Zj=new Db;this.B=null;this.Dr=!1}t=Hi.prototype;t.clear=function(){this.vp.clear();this.Wo.clear();this.Ia.clear();this.ef.clear();this.df.clear();this.Zj.clear()};
t.ie=function(a){F&&null!==a&&x(a,Q,Hi,"setDiagram");this.B=a};t.yj=function(a){if(a instanceof U){if(this.vp.add(a),a instanceof Hf){var b=a.containingGroup;null===b?this.B.Oh.add(a):b.Zl.add(a);b=a.layout;null!==b&&(b.diagram=this.B)}}else a instanceof R?this.Wo.add(a):a instanceof Te||this.Ia.add(a);b=a.data;null===b||a instanceof Te||(a instanceof R?this.df.add(b,a):this.ef.add(b,a))};
t.Qc=function(a){a.xk();if(a instanceof U){if(this.vp.remove(a),a instanceof Hf){var b=a.containingGroup;null===b?this.B.Oh.remove(a):b.Zl.remove(a);b=a.layout;null!==b&&(b.diagram=null)}}else a instanceof R?this.Wo.remove(a):a instanceof Te||this.Ia.remove(a);b=a.data;null===b||a instanceof Te||(a instanceof R?this.df.remove(b):this.ef.remove(b))};
t.Ld=function(){for(var a=this.B.nodeTemplateMap.iterator;a.next();){var b=a.value,c=a.key;(!b.bc()||b instanceof Hf)&&v('Invalid node template in Diagram.nodeTemplateMap: template for "'+c+'" must be a Node or a simple Part, not a Group or Link: '+b)}for(a=this.B.groupTemplateMap.iterator;a.next();)b=a.value,c=a.key,b instanceof Hf||v('Invalid group template in Diagram.groupTemplateMap: template for "'+c+'" must be a Group, not a normal Node or Link: '+b);for(a=this.B.linkTemplateMap.iterator;a.next();)b=
a.value,c=a.key,b instanceof R||v('Invalid link template in Diagram.linkTemplateMap: template for "'+c+'" must be a Link, not a normal Node or simple Part: '+b);a=La();for(b=this.B.selection.iterator;b.next();)(c=b.value.data)&&a.push(c);b=La();for(c=this.B.highlighteds.iterator;c.next();){var d=c.value.data;d&&b.push(d)}c=La();for(d=this.nodes.iterator;d.next();){var e=d.value;null!==e.data&&(c.push(e.data),c.push(e.location))}for(d=this.links.iterator;d.next();)e=d.value,null!==e.data&&(c.push(e.data),
c.push(e.location));for(d=this.parts.iterator;d.next();)e=d.value,null!==e.data&&(c.push(e.data),c.push(e.location));this.removeAllModeledParts();this.addAllModeledParts();for(d=0;d<a.length;d++)e=this.Ec(a[d]),null!==e&&(e.isSelected=!0);for(d=0;d<b.length;d++)e=this.Ec(b[d]),null!==e&&(e.isHighlighted=!0);for(d=0;d<c.length;d+=2)e=this.Ec(c[d]),null!==e&&(e.location=c[d+1]);Oa(a);Oa(b);Oa(c)};Hi.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)};
Hi.prototype.addModeledParts=function(a,b){var c=this,d=this.diagram.model;a.forEach(function(a){d.$a(a)&&Nq(c,a,!1)});a.forEach(function(a){d.$a(a)&&c.resolveReferencesForData(a)});!1!==b&&pk(this.diagram,!1)};
function Nq(a,b,c){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.ef.contains(b)){void 0===c&&(c=!0);a:{if(void 0!==b&&null!==b&&!a.B.undoManager.isUndoingRedoing&&!a.ef.contains(b)){var d=a.Tq(b);var e=ap(a,b,d);if(null!==e&&(Lg(e),e=e.copy(),null!==e)){var f=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Yf=d;e.qb=b;a.Dr&&(e.th="Tool");a.diagram.add(e);e.qb=null;e.data=b;a.diagram.skipsModelSourceBindings=f;d=e;break a}}d=null}null!==d&&c&&a.resolveReferencesForData(b)}}
Hi.prototype.insertLink=function(){return null};Hi.prototype.resolveReferencesForData=function(){};Hi.prototype.Tq=function(a){return this.B.model.Tq(a)};
function ap(a,b,c){a=a.B;var d=a.model;d.zj()&&d.fu(b)?(b=a.groupTemplateMap.K(c),null===b&&(b=a.groupTemplateMap.K(""),null===b&&(Oq||(Oq=!0,Ca('No Group template found for category "'+c+'"'),Ca("  Using default group template")),b=a.Qu))):(b=a.nodeTemplateMap.K(c),null===b&&(b=a.nodeTemplateMap.K(""),null===b&&(Pq||(Pq=!0,Ca('No Node template found for category "'+c+'"'),Ca("  Using default node template")),b=a.Su)));return b}Hi.prototype.getLinkCategoryForData=function(){return""};
Hi.prototype.setLinkCategoryForData=function(){};Hi.prototype.setFromNodeForLink=function(){};Hi.prototype.setToNodeForLink=function(){};Hi.prototype.findLinkTemplateForCategory=function(a){var b=this.B.linkTemplateMap.K(a);null===b&&(b=this.B.linkTemplateMap.K(""),null===b&&(Qq||(Qq=!0,Ca('No Link template found for category "'+a+'"'),Ca("  Using default link template")),b=this.B.Ru));return b};Hi.prototype.removeAllModeledParts=function(){this.su(this.diagram.model.nodeDataArray)};
Hi.prototype.su=function(a){var b=this;a.forEach(function(a){b.pr(a)})};Hi.prototype.pr=function(a){a=this.Ec(a);null!==a&&(Yj(this.diagram,a,!1),this.unresolveReferencesForPart(a))};Hi.prototype.unresolveReferencesForPart=function(){};Hi.prototype.removeDataForLink=function(){};Hi.prototype.findPartForKey=function(a){if(null===a||void 0===a)return null;a=this.B.model.Qb(a);return null!==a?this.ef.K(a):null};
Hi.prototype.Hb=function(a){if(null===a||void 0===a)return null;a=this.B.model.Qb(a);if(null===a)return null;a=this.ef.K(a);return a instanceof U?a:null};Hi.prototype.findLinkForKey=function(){return null};t=Hi.prototype;t.Ec=function(a){if(null===a)return null;var b=this.ef.K(a);return null!==b?b:b=this.df.K(a)};t.rj=function(a){if(null===a)return null;a=this.ef.K(a);return a instanceof U?a:null};t.Dc=function(a){return null===a?null:this.df.K(a)};
t.Wt=function(a){for(var b=0;b<arguments.length;++b);b=new I;for(var c=this.vp.iterator;c.next();){var d=c.value,e=d.data;if(null!==e)for(var f=0;f<arguments.length;f++){var g=arguments[f];if(Fa(g)&&Rq(this,e,g)){b.add(d);break}}}return b.iterator};t.Vt=function(a){for(var b=0;b<arguments.length;++b);b=new I;for(var c=this.Wo.iterator;c.next();){var d=c.value,e=d.data;if(null!==e)for(var f=0;f<arguments.length;f++){var g=arguments[f];if(Fa(g)&&Rq(this,e,g)){b.add(d);break}}}return b.iterator};
function Rq(a,b,c){for(var d in c){var e=b[d],f=c[d];if(Ga(f)){if(!Ga(e)||e.length<f.length)return!1;for(var g=0;g<e.length;g++){var h=f[g];if(void 0!==h&&!Sq(a,e[g],h))return!1}}else if(!Sq(a,e,f))return!1}return!0}function Sq(a,b,c){if("function"===typeof c){if(!c(b))return!1}else if(c instanceof RegExp){if(!b||!c.test(b.toString()))return!1}else if(Fa(b)&&Fa(c)){if(!Rq(a,b,c))return!1}else if(b!==c)return!1;return!0}
Hi.prototype.doModelChanged=function(a){if(this.B){var b=this.B;if(a.model===b.model){var c=a.change;b.doModelChanged(a);if(b.ba){b.ba=!1;try{var d=a.modelChange;if(""!==d)if(c===He){if("nodeCategory"===d){var e=this.Ec(a.object),f=a.newValue;null!==e&&"string"===typeof f&&(e.category=f)}else"nodeDataArray"===d&&(this.su(a.oldValue),this.addModeledParts(a.newValue));b.isModified=!0}else if(c===Je){var g=a.newValue;"nodeDataArray"===d&&Fa(g)&&Nq(this,g);b.isModified=!0}else if(c===Ke){var h=a.oldValue;
"nodeDataArray"===d&&Fa(h)&&this.pr(h);b.isModified=!0}else c===Ie&&("SourceChanged"===d?null!==a.object?this.updateDataBindings(a.object,a.propertyName):(this.zr(),this.updateAllTargetBindings()):"ModelDisplaced"===d&&this.Ld());else if(c===He){var k=a.propertyName,l=a.object;if(l===b.model){if("nodeKeyProperty"===k||"nodeCategoryProperty"===k)b.undoManager.isUndoingRedoing||this.Ld()}else this.updateDataBindings(l,k);b.isModified=!0}else if(c===Je||c===Ke){var m=a.change===Je,n=m?a.newParam:a.oldParam,
p=m?a.newValue:a.oldValue,r=this.Zj.K(a.object);if(Array.isArray(r))for(a=0;a<r.length;a++){var q=r[a];if(m)Bn(q,p,n);else if(!(0>n)){var u=n+tn(q);q.Qc(u,!0);Fn(q,u,n)}}b.isModified=!0}}finally{b.ba=!0}}}}};Hi.prototype.updateAllTargetBindings=function(a){void 0===a&&(a="");for(var b=this.parts.iterator;b.next();)b.value.Ha(a);for(b=this.nodes.iterator;b.next();)b.value.Ha(a);for(b=this.links.iterator;b.next();)b.value.Ha(a)};
Hi.prototype.zr=function(){for(var a=this.B.model,b=new I,c=a.nodeDataArray,d=0;d<c.length;d++)b.add(c[d]);var e=[];this.nodes.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});this.parts.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});e.forEach(function(b){Tq(a,b,!1)});for(d=0;d<c.length;d++){var f=c[d];null===this.Ec(f)&&Uq(a,f,!1)}this.refreshDataBoundLinks();for(c=this.parts.iterator;c.next();)c.value.updateRelationshipsFromData();for(c=this.nodes.iterator;c.next();)c.value.updateRelationshipsFromData();
for(c=this.links.iterator;c.next();)c.value.updateRelationshipsFromData()};Hi.prototype.refreshDataBoundLinks=function(){};Hi.prototype.updateRelationshipsFromData=function(){};
Hi.prototype.updateDataBindings=function(a,b){if("string"===typeof b){var c=this.Ec(a);if(null!==c)c.Ha(b);else{c=null;for(var d=this.Zj.iterator;d.next();){for(var e=d.value,f=0;f<e.length;f++){var g=e[f].Dy(a);null!==g&&(null===c&&(c=La()),c.push(g))}if(null!==c)break}if(null!==c){for(d=0;d<c.length;d++)c[d].Ha(b);Oa(c)}}a===this.diagram.model.modelData&&this.updateAllTargetBindings(b)}};
function Uj(a,b){var c=b.Mi;if(Ga(c)){var d=a.Zj.K(c);if(null===d)d=[],d.push(b),a.Zj.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}function Xj(a,b,c){Sj(b,function(a){a=a.$.j;for(var b=a.length,d=0;d<b;d++)nk(c,a[d])});var d=b.Mi;if(Ga(d)){var e=a.Zj.K(d);if(null!==e)for(var f=0;f<e.length;f++)if(e[f]===b){e.splice(f,1);0===e.length&&a.Zj.remove(d);break}}}
Hi.prototype.Ck=function(a,b,c){var d=new Db;if(Ga(a))for(var e=0;e<a.length;e++)Vq(this,a[e],b,d,c);else for(a=a.iterator;a.next();)Vq(this,a.value,b,d,c);if(null!==b){c=b.model;a=b.toolManager.findTool("Dragging");a=null!==a?a.dragOptions.dragsLink:b.pl.dragsLink;e=new I;for(var f=new Db,g=d.iterator;g.next();){var h=g.value;if(h instanceof R)a||null!==h.fromNode&&null!==h.toNode||e.add(h);else if(h instanceof U&&null!==h.data&&c.Om()){var k=h;h=g.key;var l=h.Rg();null!==l&&(l=d.K(l),null!==l?(c.je(k.data,
c.pa(l.data)),k=b.Dc(k.data),h=h.uj(),null!==h&&null!==k&&f.add(h,k)):c.je(k.data,void 0))}}0<e.count&&b.tu(e,!1);if(0<f.count)for(c=f.iterator;c.next();)d.add(c.key,c.value)}if(null!==b&&null!==this.B&&(b=b.model,c=b.afterCopyFunction,null!==c)){var m=new Db;d.each(function(a){null!==a.key.data&&m.add(a.key.data,a.value.data)});c(m,b,this.B.model)}for(b=d.iterator;b.next();)b.value.Ha();return d};
function Vq(a,b,c,d,e){if(null===b||e&&!b.canCopy())return null;if(d.contains(b))return d.K(b);var f=a.copyPartData(b,c);if(!(f instanceof S))return null;f.isSelected=!1;f.isHighlighted=!1;d.add(b,f);if(b instanceof U){for(var g=b.linksConnected;g.next();){var h=g.value;if(h.fromNode===b){var k=d.K(h);null!==k&&(k.fromNode=f)}h.toNode===b&&(h=d.K(h),null!==h&&(h.toNode=f))}if(b instanceof Hf&&f instanceof Hf)for(b=b.memberParts;b.next();)g=Vq(a,b.value,c,d,e),g instanceof R||null===g||(g.containingGroup=
f)}else if(b instanceof R&&f instanceof R)for(g=b.fromNode,null!==g&&(g=d.K(g),null!==g&&(f.fromNode=g)),g=b.toNode,null!==g&&(g=d.K(g),null!==g&&(f.toNode=g)),b=b.labelNodes;b.next();)g=Vq(a,b.value,c,d,e),null!==g&&g instanceof U&&(g.labeledLink=f);return f}
Hi.prototype.copyPartData=function(a,b){var c=null,d=a.data;if(null!==d&&null!==b){var e=b.model;a instanceof R||(d=e.copyNodeData(d),Fa(d)&&(e.Gf(d),c=b.Ec(d)))}else Lg(a),c=a.copy(),null!==c&&(e=this.B,null!==b?b.add(c):null!==d&&null!==e&&null!==e.commandHandler&&e.commandHandler.copiesClipboardData&&(b=e.model,e=null,c instanceof R||(e=b.copyNodeData(d)),Fa(e)&&(c.data=e)));return c};
ma.Object.defineProperties(Hi.prototype,{nodes:{configurable:!0,get:function(){return this.vp}},links:{configurable:!0,get:function(){return this.Wo}},parts:{configurable:!0,get:function(){return this.Ia}},diagram:{configurable:!0,get:function(){return this.B}},addsToTemporaryLayer:{configurable:!0,get:function(){return this.Dr},set:function(a){A(a,"boolean",Hi,"addsToTemporaryLayer");this.Dr=a}}});
Hi.prototype.updateAllRelationshipsFromData=Hi.prototype.zr;Hi.prototype.findLinksByExample=Hi.prototype.Vt;Hi.prototype.findNodesByExample=Hi.prototype.Wt;Hi.prototype.findLinkForData=Hi.prototype.Dc;Hi.prototype.findNodeForData=Hi.prototype.rj;Hi.prototype.findPartForData=Hi.prototype.Ec;Hi.prototype.findNodeForKey=Hi.prototype.Hb;Hi.prototype.removeModeledPart=Hi.prototype.pr;Hi.prototype.removeModeledParts=Hi.prototype.su;Hi.prototype.rebuildParts=Hi.prototype.Ld;var Pq=!1,Oq=!1,Qq=!1;
Hi.className="PartManager";function Wq(a){Hi.apply(this,arguments)}la(Wq,Hi);Wq.prototype.addAllModeledParts=function(){var a=this.diagram.model;this.addModeledParts(a.nodeDataArray);Xq(this,a.linkDataArray)};Wq.prototype.addModeledParts=function(a){Hi.prototype.addModeledParts.call(this,a,!1);for(a=this.links.iterator;a.next();)bp(a.value);pk(this.diagram,!1)};function Xq(a,b){b.forEach(function(b){Yq(a,b)});pk(a.diagram,!1)}
function Yq(a,b){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.df.contains(b)){var c=a.getLinkCategoryForData(b),d=a.findLinkTemplateForCategory(c);if(null!==d){Lg(d);var e=d.copy();if(null!==e){d=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Yf=c;e.qb=b;c=a.diagram.model;var f=Zq(c,b,!0);""!==f&&(e.fromPortId=f);f=$q(c,b,!0);void 0!==f&&(f=a.Hb(f),f instanceof U&&(e.fromNode=f));f=Zq(c,b,!1);""!==f&&(e.toPortId=f);f=$q(c,b,!1);void 0!==f&&(f=a.Hb(f),
f instanceof U&&(e.toNode=f));c=c.Nf(b);Array.isArray(c)&&c.forEach(function(b){b=a.Hb(b);null!==b&&(b.labeledLink=e)});a.Dr&&(e.th="Tool");a.diagram.add(e);e.qb=null;e.data=b;a.diagram.skipsModelSourceBindings=d}}}}Wq.prototype.removeAllModeledParts=function(){var a=this.diagram.model;ar(this,a.linkDataArray);this.su(a.nodeDataArray)};function ar(a,b){b.forEach(function(b){a.pr(b)})}Wq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Zt(a)};
Wq.prototype.setLinkCategoryForData=function(a,b){return this.diagram.model.sr(a,b)};Wq.prototype.setFromNodeForLink=function(a,b){var c=this.diagram.model;c.Ow(a.data,c.pa(null!==b?b.data:null))};Wq.prototype.setToNodeForLink=function(a,b){var c=this.diagram.model;c.Tw(a.data,c.pa(null!==b?b.data:null))};Wq.prototype.removeDataForLink=function(a){this.diagram.model.Zm(a.data)};
Wq.prototype.findPartForKey=function(a){var b=Hi.prototype.findPartForKey.call(this,a);return null===b&&(a=this.diagram.model.Pg(a),null!==a)?this.df.K(a):b};Wq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Pg(a);return null!==a?this.df.K(a):null};
Wq.prototype.doModelChanged=function(a){var b=this;Hi.prototype.doModelChanged.call(this,a);if(this.diagram){var c=this.diagram;if(a.model===c.model){var d=a.change;if(c.ba){c.ba=!1;try{var e=a.modelChange;if(""!==e)if(d===He){if("linkFromKey"===e){var f=this.Dc(a.object);if(null!==f){var g=this.Hb(a.newValue);f.fromNode=g}}else if("linkToKey"===e){var h=this.Dc(a.object);if(null!==h){var k=this.Hb(a.newValue);h.toNode=k}}else if("linkFromPortId"===e){var l=this.Dc(a.object);if(null!==l){var m=a.newValue;
"string"===typeof m&&(l.fromPortId=m)}}else if("linkToPortId"===e){var n=this.Dc(a.object);if(null!==n){var p=a.newValue;"string"===typeof p&&(n.toPortId=p)}}else if("nodeGroupKey"===e){var r=this.Ec(a.object);if(null!==r){var q=a.newValue;if(void 0!==q){var u=this.Hb(q);u instanceof Hf?r.containingGroup=u:r.containingGroup=null}else r.containingGroup=null}}else if("linkLabelKeys"===e){var w=this.Dc(a.object);if(null!==w){var y=a.oldValue,z=a.newValue;Array.isArray(y)&&y.forEach(function(a){0<=z.indexOf(a)||
(a=b.Hb(a),null!==a&&(a.labeledLink=null))});Array.isArray(z)&&z.forEach(function(a){a=b.Hb(a);null!==a&&(a.labeledLink=w)})}}else if("linkCategory"===e){var B=this.Dc(a.object),D=a.newValue;null!==B&&"string"===typeof D&&(B.category=D)}else"linkDataArray"===e&&(ar(this,a.oldValue),Xq(this,a.newValue));c.isModified=!0}else if(d===Je){var G=a.newValue;if("linkDataArray"===e&&"object"===typeof G&&null!==G)Yq(this,G);else if("linkLabelKeys"===e&&br(G)){var O=this.Dc(a.object),T=this.Hb(G);null!==O&&
null!==T&&(T.labeledLink=O)}c.isModified=!0}else{if(d===Ke){var P=a.oldValue;if("linkDataArray"===e&&"object"===typeof P&&null!==P)this.pr(P);else if("linkLabelKeys"===e&&br(P)){var ba=this.Hb(P);null!==ba&&(ba.labeledLink=null)}c.isModified=!0}}else if(d===He){var Y=a.propertyName;a.object!==c.model||"linkFromKeyProperty"!==Y&&"linkToKeyProperty"!==Y&&"linkFromPortIdProperty"!==Y&&"linkToPortIdProperty"!==Y&&"linkLabelKeysProperty"!==Y&&"nodeIsGroupProperty"!==Y&&"nodeGroupKeyProperty"!==Y&&"linkCategoryProperty"!==
Y||c.undoManager.isUndoingRedoing||this.Ld();c.isModified=!0}}finally{c.ba=!0}}}}};Wq.prototype.refreshDataBoundLinks=function(){var a=this,b=this.diagram.model,c=new I,d=b.linkDataArray;d.forEach(function(a){c.add(a)});var e=[];this.links.each(function(a){null===a.data||c.contains(a.data)||e.push(a.data)});e.forEach(function(a){cr(b,a,!1)});d.forEach(function(c){null===a.Dc(c)&&dr(b,c,!1)})};
Wq.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;if(a instanceof R){var e=$q(d,b,!0);e=c.Hb(e);a.fromNode=e;e=$q(d,b,!1);e=c.Hb(e);a.toNode=e;b=d.Nf(b);if(0<b.length||0<a.labelNodes.count){if(1===b.length&&1===a.labelNodes.count){e=b[0];var f=a.labelNodes.first();if(d.pa(f.data)===e)return}e=(new I).addAll(b);var g=new I;a.labelNodes.each(function(a){null!==a.data&&(a=d.pa(a.data),void 0!==a&&g.add(a))});b=g.copy();b.nr(e);e=
e.copy();e.nr(g);if(0<b.count||0<e.count)b.each(function(b){b=c.Hb(b);null!==b&&b.labeledLink===a&&(b.labeledLink=null)}),e.each(function(b){b=c.Hb(b);null!==b&&b.labeledLink!==a&&(b.labeledLink=a)})}}else!(a instanceof Te)&&(b=d.Wh(b),b=c.findPartForKey(b),null===b||b instanceof Hf)&&(a.containingGroup=b)}}};
Wq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.pa(a);if(void 0!==c){var d=er(b,c),e=this.Ec(a);if(null!==d&&null!==e){d=d.iterator;for(var f={};d.next();){var g=d.value;b.$a(g)?e instanceof Hf&&b.Wh(g)===c&&(g=this.Ec(g),null!==g&&(g.containingGroup=e)):(f.link=this.Dc(g),null!==f.link&&e instanceof U&&($q(b,g,!0)===c&&(f.link.fromNode=e),$q(b,g,!1)===c&&(f.link.toNode=e),g=b.Nf(g),Array.isArray(g)&&g.some(function(a){return function(b){return b===c?(e.labeledLink=
a.link,!0):!1}}(f))));f={link:f.link}}fr(b,c)}a=b.Wh(a);void 0!==a&&(a=this.Hb(a),a instanceof Hf&&(e.containingGroup=a))}};Wq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof U){var c=b.pa(a.data);if(void 0!==c){for(var d=a.linksConnected;d.next();)gr(b,c,d.value.data);a.isLinkLabel&&(d=a.labeledLink,null!==d&&gr(b,c,d.data));if(a instanceof Hf)for(a=a.memberParts;a.next();)d=a.value.data,b.$a(d)&&gr(b,c,d)}}};
Wq.prototype.copyPartData=function(a,b){var c=Hi.prototype.copyPartData.call(this,a,b);if(a instanceof R)if(a=a.data,null!==a&&null!==b){var d=b.model;a=d.Lq(a);"object"===typeof a&&null!==a&&(d.mj(a),c=b.Dc(a))}else null!==c&&(b=this.diagram,null!==a&&null!==b&&null!==b.commandHandler&&b.commandHandler.copiesClipboardData&&(b=b.model.Lq(a),"object"===typeof b&&null!==b&&(c.data=b)));return c};
Wq.prototype.insertLink=function(a,b,c,d){var e=this.diagram,f=e.model,g=e.toolManager.findTool("Linking"),h="";null!==a&&(null===b&&(b=a),h=b.portId,null===h&&(h=""));b="";null!==c&&(null===d&&(d=c),b=d.portId,null===b&&(b=""));d=g.archetypeLinkData;if(d instanceof R){if(Lg(d),f=d.copy(),null!==f)return f.fromNode=a,f.fromPortId=h,f.toNode=c,f.toPortId=b,e.add(f),a=g.archetypeLabelNodeData,a instanceof U&&(Lg(a),a=a.copy(),null!==a&&(a.labeledLink=f,e.add(a))),f}else if(null!==d&&(d=f.Lq(d),"object"===
typeof d&&null!==d))return null!==a&&hr(f,d,f.pa(a.data),!0),ir(f,d,h,!0),null!==c&&hr(f,d,f.pa(c.data),!1),ir(f,d,b,!1),f.mj(d),a=g.archetypeLabelNodeData,null===a||a instanceof U||(a=f.copyNodeData(a),"object"===typeof a&&null!==a&&(f.Gf(a),a=f.pa(a),void 0!==a&&f.Qv(d,a))),e.Dc(d);return null};Wq.prototype.findLinkForKey=Wq.prototype.findLinkForKey;Wq.prototype.findPartForKey=Wq.prototype.findPartForKey;Wq.prototype.removeAllModeledParts=Wq.prototype.removeAllModeledParts;
Wq.prototype.addModeledParts=Wq.prototype.addModeledParts;Wq.prototype.addAllModeledParts=Wq.prototype.addAllModeledParts;Wq.className="GraphLinksPartManager";function jr(){Hi.apply(this,arguments);this.Bh=null}la(jr,Hi);
function kr(a,b,c){if(null!==b&&null!==c){var d=a.diagram.toolManager.findTool("Linking"),e=b,f=c;if(a.diagram.isTreePathToChildren)for(b=f.linksConnected;b.next();){if(b.value.toNode===f)return}else for(e=c,f=b,b=e.linksConnected;b.next();)if(b.value.fromNode===e)return;if(null===d||!bg(d,e,f,null,!0))if(d=a.getLinkCategoryForData(c.data),b=a.findLinkTemplateForCategory(d),null!==b&&(Lg(b),b=b.copy(),null!==b)){var g=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;b.Yf=d;
b.qb=c.data;b.fromNode=e;b.toNode=f;a.diagram.add(b);b.qb=null;b.data=c.data;a.diagram.skipsModelSourceBindings=g}}}jr.prototype.getLinkCategoryForData=function(a){return this.diagram.model.au(a)};jr.prototype.setLinkCategoryForData=function(a,b){this.diagram.model.xu(a,b)};
jr.prototype.setFromNodeForLink=function(a,b,c){var d=this.diagram.model;void 0===c&&(c=null);b=null!==b?b.data:null;if(this.diagram.isTreePathToChildren)d.je(a.data,d.pa(b));else{var e=this.Bh;this.Bh=a;null!==c&&d.je(c.data,void 0);d.je(b,d.pa(null!==a.toNode?a.toNode.data:null));this.Bh=e}};
jr.prototype.setToNodeForLink=function(a,b,c){var d=this.diagram.model;void 0===c&&(c=null);b=null!==b?b.data:null;if(this.diagram.isTreePathToChildren){var e=this.Bh;this.Bh=a;null!==c&&d.je(c.data,void 0);d.je(b,d.pa(null!==a.fromNode?a.fromNode.data:null));this.Bh=e}else d.je(a.data,d.pa(b))};jr.prototype.removeDataForLink=function(a){this.diagram.model.je(a.data,void 0)};
jr.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Qb(a);return null!==a?this.df.K(a):null};
jr.prototype.doModelChanged=function(a){Hi.prototype.doModelChanged.call(this,a);if(this.diagram){var b=this.diagram;if(a.model===b.model){var c=a.change;if(b.ba){b.ba=!1;try{var d=a.modelChange;if(""!==d){if(c===He){if("nodeParentKey"===d){var e=a.object,f=this.Hb(a.newValue),g=this.rj(e);if(null!==this.Bh)null!==f&&(this.Bh.data=e,this.Bh.category=this.getLinkCategoryForData(e));else if(null!==g){var h=g.uj();null!==h?null===f?b.remove(h):b.isTreePathToChildren?h.fromNode=f:h.toNode=f:kr(this,f,
g)}}else if("parentLinkCategory"===d){var k=this.rj(a.object),l=a.newValue;if(null!==k&&"string"===typeof l){var m=k.uj();null!==m&&(m.category=l)}}b.isModified=!0}}else if(c===He){var n=a.propertyName;a.object===b.model&&"nodeParentKeyProperty"===n&&(b.undoManager.isUndoingRedoing||this.Ld());b.isModified=!0}}finally{b.ba=!0}}}}};
jr.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;a instanceof U&&(b=d.Xh(b),b=c.Hb(b),d=a.Rg(),b!==d&&(d=a.uj(),null!==b?null!==d?c.isTreePathToChildren?d.fromNode=b:d.toNode=b:kr(this,b,a):null!==d&&Yj(c,d,!1)))}}};jr.prototype.updateDataBindings=function(a,b){Hi.prototype.updateDataBindings.call(this,a,b);"string"===typeof b&&null!==this.Ec(a)&&(a=this.Dc(a),null!==a&&a.Ha(b))};
jr.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.pa(a);if(void 0!==c){var d=er(b,c),e=this.Ec(a);if(null!==d&&null!==e){for(d=d.iterator;d.next();){var f=d.value;b.$a(f)&&e instanceof U&&b.Xh(f)===c&&kr(this,e,this.rj(f))}fr(b,c)}a=b.Xh(a);void 0!==a&&e instanceof U&&(a=this.Hb(a),kr(this,a,e))}};
jr.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof U){var c=b.pa(a.data),d=this.Dc(a.data);if(null!==d){d.isSelected=!1;d.isHighlighted=!1;var e=d.layer;if(null!==e){var f=e.Qc(-1,d,!1);0<=f&&this.diagram.hb(Ke,"parts",e,d,null,f,null);f=d.layerChanged;null!==f&&f(d,e,null)}}d=this.diagram.isTreePathToChildren;for(a=a.linksConnected;a.next();)e=a.value,e=(d?e.toNode:e.fromNode).data,b.$a(e)&&gr(b,c,e)}};
jr.prototype.insertLink=function(a,b,c){b=this.diagram.model;var d=a,e=c;this.diagram.isTreePathToChildren||(d=c,e=a);return null!==d&&null!==e?(b.je(e.data,b.pa(d.data)),e.uj()):null};jr.prototype.findLinkForKey=jr.prototype.findLinkForKey;jr.className="TreePartManager";
function W(a){this.Yi=new I;this.Vi=new I;this.Fu=',\n  "insertedNodeKeys": ';this.yx=',\n  "modifiedNodeData": ';this.Hu=',\n  "removedNodeKeys": ';this.ii=null;F&&1<arguments.length&&v("Model constructor can only take one optional argument, the Array of node data.");fb(this);this.Xn=this.Wa="";this.lg=!1;this.l={};this.wc=[];this.ab=new Db;this.Xi="key";this.nl=this.Wl=null;this.On=this.Pn=!1;this.Rn=!0;this.vn=null;this.gk="category";this.dg=new Db;this.ov=new H;this.Gg=!1;this.w=null;this.undoManager=
new Me;void 0!==a&&(this.nodeDataArray=a)}W.prototype.cloneProtected=function(a){a.Wa=this.Wa;a.Xn=this.Xn;a.lg=this.lg;a.Xi=this.Xi;a.Wl=this.Wl;a.nl=this.nl;a.Pn=this.Pn;a.On=this.On;a.Rn=this.Rn;a.vn=this.vn;a.gk=this.gk};W.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};W.prototype.clear=function(){this.wc=[];this.ab.clear();this.dg.clear();this.undoManager.clear()};
W.prototype.toString=function(a){void 0===a&&(a=0);if(1<a)return this.wr();var b=(""!==this.name?this.name:"")+" Model";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+Qa(e)}}return b};
W.prototype.tB=function(a){x(a,Ge,W,"toIncrementalData:e");a.change!==Ie&&v("Model.toIncrementalData argument is not a Transaction ChangedEvent:"+a.toString());var b=a.object;if(!(a.isTransactionFinished&&b instanceof Le))return null;lr(this,b);a=this.mx(b,"FinishedUndo"===a.propertyName);this.ii=null;return a};
W.prototype.mx=function(a,b){var c=this,d=!1,e=new I,f=new I,g=new I,h=this.ii;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===Je?e.add(a.newValue):a.change===Ke&&g.add(a.oldValue):c.$a(a.object)?f.add(a.object):a.change!==He||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.$a(a)&&f.add(a)}):a.object instanceof W||c.Bj()&&c.Cc(a.object)||mr(c,a.object).each(function(a){f.add(a)})):
d=!0)});var k=this.Vi;k.clear();e.each(function(a){k.add(c.pa(a));b||f.add(a)});var l=this.Yi;l.clear();g.each(function(a){l.add(c.pa(a));b&&f.add(a)});a=c.cloneDeep(f.ta());var m=null;d&&(null===m&&(m={}),m.modelData=this.cloneDeep(this.modelData));0<k.count&&(null===m&&(m={}),b?m.removedNodeKeys=k.ta():m.insertedNodeKeys=k.ta());0<a.length&&(null===m&&(m={}),m.modifiedNodeData=a);0<l.count&&(null===m&&(m={}),b?m.insertedNodeKeys=l.ta():m.removedNodeKeys=l.ta());l.clear();k.clear();return m};
W.prototype.cloneDeep=function(a){return nr(this,a,!0)};
function nr(a,b,c,d,e,f){function g(a,c){h?(void 0===a.__gohashid&&f.push(a),d.set(a,c)):(a=wb++,d.set(a,c),e.set(a,b))}if(!Fa(b))return b;f||(f=[]);var h=Object.isExtensible(b);d||(d=new Db);if(h){var k=d.get(b);if(k)return k}else for(e||(e=new Db),k=e.iterator;k.next();){var l=k.key;if(k.value===b&&(l=d.get(l)))return l}if(Array.isArray(b)){k=[];g(b,k);for(var m=0;m<b.length;m++)k.push(nr(a,b[m],!1,d,e,f))}else if(b instanceof J||b instanceof Hb||b instanceof L||b instanceof lc||b instanceof M)k=
b.copy(),g(b,k);else{if(b instanceof Hl||b instanceof Fd||b instanceof E)return b;if(b instanceof H)k=(new H).addAll(nr(a,b.ta(),!1,d,e,f)),g(b,k);else if(b instanceof I)k=(new I).addAll(nr(a,b.ta(),!1,d,e,f)),g(b,k);else if(b instanceof Db)k=(new Db).addAll(nr(a,b.ta(),!1,d,e,f)),g(b,k);else if(b instanceof Date)k=new Date(b.getTime()),g(b,k);else if(b instanceof RegExp)k=new RegExp(b),g(b,k),k.lastIndex=b.lastIndex;else if("function"===typeof b.copy)k=b.copy(),g(b,k);else for(m in k={},g(b,k),b)"__gohashid"!==
m&&(k[m]=nr(a,b[m],!1,d,e,f))}c&&f.forEach(function(a){delete a.__gohashid});return k}t=W.prototype;
t.Zk=function(){var a="";""!==this.name&&(a+=',\n  "name": '+this.quote(this.name));""!==this.dataFormat&&(a+=',\n  "dataFormat": '+this.quote(this.dataFormat));this.isReadOnly&&(a+=',\n  "isReadOnly": '+this.isReadOnly);"key"!==this.nodeKeyProperty&&"string"===typeof this.nodeKeyProperty&&(a+=',\n  "nodeKeyProperty": '+this.quote(this.nodeKeyProperty));this.copiesArrays&&(a+=',\n  "copiesArrays": true');this.copiesArrayObjects&&(a+=',\n  "copiesArrayObjects": true');this.copiesKey||(a+=',\n  "copiesKey": false');
"category"!==this.nodeCategoryProperty&&"string"===typeof this.nodeCategoryProperty&&(a+=',\n  "nodeCategoryProperty": '+this.quote(this.nodeCategoryProperty));return a};
t.lr=function(a){a.name&&(this.name=a.name);a.dataFormat&&(this.dataFormat=a.dataFormat);a.isReadOnly&&(this.isReadOnly=!0);a.nodeKeyProperty&&(this.nodeKeyProperty=a.nodeKeyProperty);a.copiesArrays&&(this.copiesArrays=!0);a.copiesArrayObjects&&(this.copiesArrayObjects=!0);!1===a.copiesKey&&(this.copiesKey=!1);a.nodeCategoryProperty&&(this.nodeCategoryProperty=a.nodeCategoryProperty)};function or(a){return',\n  "modelData": '+pr(a,a.modelData)}
function qr(a,b){b=b.modelData;Fa(b)&&(a.an(b),a.modelData=b)}t.nx=function(){var a=this.modelData,b=!1,c;for(c in a)if(!rr(c,a[c])){b=!0;break}a="";b&&(a=or(this));return a+',\n  "nodeDataArray": '+sr(this,this.nodeDataArray,!0)};t.Cw=function(a){qr(this,a);a=a.nodeDataArray;Ga(a)&&(this.an(a),this.nodeDataArray=a)};
function tr(a,b,c,d){if(b===c)return!0;if(typeof b!==typeof c||"function"===typeof b||"function"===typeof c)return!1;if(Array.isArray(b)&&Array.isArray(c)){if(d.K(b)===c)return!0;d.add(b,c);if(b.length!==c.length)return!1;for(var e=0;e<b.length;e++)if(!tr(a,b[e],c[e],d))return!1;return!0}if(Fa(b)&&Fa(c)){if(d.K(b)===c)return!0;d.add(b,c);for(var f in b){var g=b[f];if(!rr(f,g)){var h=c[f];if(void 0===h||!tr(a,g,h,d))return!1}}for(e in c)if(f=c[e],!rr(e,f)&&(g=b[e],void 0===g||!tr(a,g,f,d)))return!1;
return!0}return!1}function ur(a,b,c){a[c]!==b[c]&&v("Model.computeJsonDifference: Model."+c+' is not the same in both models: "'+a[c]+'" and "'+b[c]+'"')}
t.Br=function(a){ur(this,a,"nodeKeyProperty");var b=this.Vi;b.clear();var c=new I,d=this.Yi;d.clear();d.addAll(this.ab.iteratorKeys);for(var e=new Db,f=a.nodeDataArray,g=f.length,h=0;h<g;h++){var k=f[h],l=a.pa(k);if(void 0!==l){d.remove(l);var m=this.Qb(l);null===m?(b.add(l),c.add(k)):tr(this,m,k,e)||c.add(k)}else this.ku(k),l=this.pa(k),b.add(l),c.add(k)}f="";tr(this,this.modelData,a.modelData,e)||(f+=or(this));0<b.count&&(f+=this.Fu+sr(this,b.ta(),!0));0<c.count&&(f+=this.yx+sr(this,c.ta(),!0));
0<d.count&&(f+=this.Hu+sr(this,d.ta(),!0));d.clear();b.clear();return f};t.Pz=function(a,b){x(a,W,W,"computeJsonDifference:newmodel");void 0===b&&(b=vr(this,this));return'{ "class": '+this.quote(b)+', "incremental": 1'+this.Zk()+this.Br(a)+"}"};
function lr(a,b){function c(a,b){if(b=b.part)if(b=b.data,a!==b){var c=d.get(a);null===c?(c=new I,c.add(b),d.add(a,c)):c.add(b)}}var d=a.ii;null===d&&(d=new Db,b.changes.each(function(a){if(null!==a.diagram){var b=a.change;if(b===He)(a=a.object.panel)&&(b=a.data)&&c(b,a);else if(b===Je||b===Ke)a=a.object,(b=a.itemArray)&&c(b,a)}}),a.ii=d)}function mr(a,b){for(var c=new I,d=0;d<a.nodeDataArray.length;d++){var e=a.nodeDataArray[d];wr(a,b,e,e,c)}return c}
function wr(a,b,c,d,e){if(Array.isArray(c))for(var f=0;f<c.length;f++){var g=c[f];if(g===b)return e.add(d),!0;if(wr(a,b,g,d,e))return!0}else if(Fa(c)&&Object.getPrototypeOf(c)===Object.prototype)for(f in c){g=c[f];if(g===b)return e.add(d),!0;if(wr(a,b,g,d,e))return!0}return!1}
t.lx=function(a,b){var c=this,d=!1,e=new I,f=new I,g=new I,h=this.ii;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===Je?e.add(a.newValue):a.change===Ke&&g.add(a.oldValue):c.$a(a.object)?f.add(a.object):a.change!==He||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.$a(a)&&f.add(a)}):a.object instanceof W||c.Bj()&&c.Cc(a.object)||mr(c,a.object).each(function(a){f.add(a)})):d=!0)});var k=
this.Vi;k.clear();e.each(function(a){k.add(c.pa(a));b||f.add(a)});var l=this.Yi;l.clear();g.each(function(a){l.add(c.pa(a));b&&f.add(a)});a="";d&&(a+=or(this));0<k.count&&(a+=(b?this.Hu:this.Fu)+sr(this,k.ta(),!0));0<f.count&&(a+=this.yx+sr(this,f.ta(),!0));0<l.count&&(a+=(b?this.Fu:this.Hu)+sr(this,l.ta(),!0));l.clear();k.clear();return a};
t.kr=function(a){(void 0!==a.name&&a.name!==this.name||void 0!==a.dataFormat&&a.dataFormat!==this.dataFormat||void 0!==a.isReadOnly&&a.isReadOnly!==this.isReadOnly||void 0!==a.nodeKeyProperty&&a.nodeKeyProperty!==this.nodeKeyProperty||void 0!==a.copiesArrays&&a.copiesArrays!==this.copiesArrays||void 0!==a.copiesArrayObjects&&a.copiesArrayObjects!==this.copiesArrayObjects||void 0!==a.copiesKey&&a.copiesKey!==this.copiesKey||void 0!==a.nodeCategoryProperty&&a.nodeCategoryProperty!==this.nodeCategoryProperty)&&
v("applyIncrementalJson cannot change Model properties");qr(this,a);var b=a.insertedNodeKeys,c=a.modifiedNodeData,d=new Db;if(Array.isArray(c))for(var e=0;e<c.length;e++){var f=c[e],g=this.pa(f);void 0!==g&&null!==g&&d.set(g,f)}if(Array.isArray(b))for(e=b.length,f=0;f<e;f++){g=b[f];var h=this.Qb(g);null===h&&(h=(h=d.get(g))?h:this.copyNodeData({}),this.hn(h,g),this.Gf(h))}if(Array.isArray(c))for(b=c.length,d=0;d<b;d++)if(e=c[d],f=this.pa(e),f=this.Qb(f),null!==f){for(var k in e)"__gohashid"===k||
k===this.nodeKeyProperty||this.Jk()&&k===this.nodeIsGroupProperty||this.setDataProperty(f,k,e[k]);this.jn(e,f)}a=a.removedNodeKeys;if(Array.isArray(a))for(c=a.length,k=0;k<c;k++)b=this.Qb(a[k]),null!==b&&this.$m(b)};
t.kz=function(a,b){x(a,Ge,W,"toIncrementalJson:e");a.change!==Ie&&v("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.isTransactionFinished&&c instanceof Le))return'{ "incremental": 0 }';void 0===b&&(b=vr(this,this));lr(this,c);a=this.lx(c,"FinishedUndo"===a.propertyName);this.ii=null;return"2"===b?'{ "incremental": 2'+a+"}":'{ "class": '+this.quote(b)+', "incremental": 1'+this.Zk()+a+"}"};t.uB=function(a,b){return this.kz(a,b)};
t.wr=function(a){void 0===a&&(a=vr(this,this));return'{ "class": '+this.quote(a)+this.Zk()+this.nx()+"}"};t.toJSON=function(a){return this.wr(a)};t.my=function(a){var b=null;if("string"===typeof a)try{b=qa.JSON.parse(a)}catch(d){F&&Ca("JSON.parse error: "+d.toString())}else"object"===typeof a?b=a:v("Unable to modify a Model from: "+a);var c=b.incremental;"number"!==typeof c&&v("Unable to apply non-incremental changes to Model: "+a);0!==c&&(this.Ca("applyIncrementalJson"),this.kr(b),this.bb("applyIncrementalJson"))};
t.Gz=function(a){return this.my(a)};W.constructGraphLinksModel=function(){F&&v("Unable to construct a Model. Provided JSON requires GraphLinksModel, which is not loaded.");return new W};t=W.prototype;
t.an=function(a){if(Ga(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];if(Fa(d)){var e=c;d=this.an(d);Array.isArray(a)?a[e]=d:v("Cannot replace an object in an HTMLCollection or NodeList at "+e)}}else if(Fa(a)){for(c in a)if(e=a[c],Fa(e)&&(e=this.an(e),a[c]=e,"points"===c&&Array.isArray(e))){d=0===e.length%2;for(var f=0;f<e.length;f++)if("number"!==typeof e[f]){d=!1;break}if(d){d=new H;for(f=0;f<e.length/2;f++)d.add(new J(e[2*f],e[2*f+1]));d.freeze();a[c]=d}}if("object"===typeof a){c=a;e=a["class"]||
"";0===e.indexOf("go.")&&(e=e.substr(3));if("NaN"===e)c=NaN;else if("Date"===e)c=new Date(a.value);else if("Point"===e)c=new J(xr(a.x),xr(a.y));else if("Size"===e)c=new Hb(xr(a.width),xr(a.height));else if("Rect"===e)c=new L(xr(a.x),xr(a.y),xr(a.width),xr(a.height));else if("Margin"===e)c=new lc(xr(a.top),xr(a.right),xr(a.bottom),xr(a.left));else if("Spot"===e)"string"===typeof a["enum"]?c=zd(a["enum"]):c=new M(xr(a.x),xr(a.y),xr(a.offsetX),xr(a.offsetY));else if("Brush"===e){if(c=new Hl,c.type=gb(Hl,
a.type),"string"===typeof a.color&&(c.color=a.color),a.start instanceof M&&(c.start=a.start),a.end instanceof M&&(c.end=a.end),"number"===typeof a.startRadius&&(c.startRadius=xr(a.startRadius)),"number"===typeof a.endRadius&&(c.endRadius=xr(a.endRadius)),a=a.colorStops,Fa(a))for(b in a)c.addColorStop(parseFloat(b),a[b])}else"Geometry"===e?(b=null,"string"===typeof a.path?b=Od(a.path):b=new Fd,b.type=gb(Fd,a.type),"number"===typeof a.startX&&(b.startX=xr(a.startX)),"number"===typeof a.startY&&(b.startY=
xr(a.startY)),"number"===typeof a.endX&&(b.endX=xr(a.endX)),"number"===typeof a.endY&&(b.endY=xr(a.endY)),a.spot1 instanceof M&&(b.spot1=a.spot1),a.spot2 instanceof M&&(b.spot2=a.spot2),c=b):"EnumValue"===e&&(b=a.classType,0===b.indexOf("go.")&&(b=b.substr(3)),b=yr(b),"function"===typeof b&&(c=gb(b,a.name)));a=c}}return a};
t.quote=function(a){for(var b="",c=a.length,d=0;d<c;d++){var e=a[d];if('"'===e||"\\"===e)b+="\\"+e;else if("\b"===e)b+="\\b";else if("\f"===e)b+="\\f";else if("\n"===e)b+="\\n";else if("\r"===e)b+="\\r";else if("\t"===e)b+="\\t";else{var f=a.charCodeAt(d);b=16>f?b+("\\u000"+a.charCodeAt(d).toString(16)):32>f?b+("\\u00"+a.charCodeAt(d).toString(16)):8232===f?b+"\\u2028":8233===f?b+"\\u2029":b+e}}return'"'+b+'"'};
t.nn=function(a){return void 0===a?"undefined":null===a?"null":!0===a?"true":!1===a?"false":"string"===typeof a?this.quote(a):"number"===typeof a?Infinity===a?"9e9999":-Infinity===a?"-9e9999":isNaN(a)?'{"class":"NaN"}':a.toString():a instanceof Date?'{"class":"Date", "value":"'+a.toJSON()+'"}':a instanceof Number?this.nn(a.valueOf()):Ga(a)?sr(this,a):Fa(a)?pr(this,a):"function"===typeof a?"null":a.toString()};
function sr(a,b,c){void 0===c&&(c=!1);var d=b.length;if(0>=d)return"[]";var e=new ib;e.add("[ ");c&&1<d&&e.add("\n");for(var f=0;f<d;f++){var g=b[f];void 0!==g&&(0<f&&(e.add(","),c&&e.add("\n")),e.add(a.nn(g)))}c&&1<d&&e.add("\n");e.add(" ]");return e.toString()}function rr(a,b){return void 0===b||"__gohashid"===a||"_"===a[0]||"function"===typeof b?!0:!1}function zr(a){return isNaN(a)?"NaN":Infinity===a?"9e9999":-Infinity===a?"-9e9999":a}
function pr(a,b){var c=b;if(c instanceof J)b={"class":"go.Point",x:zr(c.x),y:zr(c.y)};else if(c instanceof Hb)b={"class":"go.Size",width:zr(c.width),height:zr(c.height)};else if(c instanceof L)b={"class":"go.Rect",x:zr(c.x),y:zr(c.y),width:zr(c.width),height:zr(c.height)};else if(c instanceof lc)b={"class":"go.Margin",top:zr(c.top),right:zr(c.right),bottom:zr(c.bottom),left:zr(c.left)};else if(c instanceof M)c.cb()?b={"class":"go.Spot",x:zr(c.x),y:zr(c.y),offsetX:zr(c.offsetX),offsetY:zr(c.offsetY)}:
b={"class":"go.Spot","enum":c.toString()};else if(c instanceof Hl){b={"class":"go.Brush",type:c.type.name};if(c.type===Kl)b.color=c.color;else if(c.type===Nl||c.type===Il)b.start=c.start,b.end=c.end,c.type===Il&&(0!==c.startRadius&&(b.startRadius=zr(c.startRadius)),isNaN(c.endRadius)||(b.endRadius=zr(c.endRadius)));if(null!==c.colorStops){var d={};for(c=c.colorStops.iterator;c.next();)d[c.key]=c.value;b.colorStops=d}}else if(c instanceof Fd)b={"class":"go.Geometry",type:c.type.name},0!==c.startX&&
(b.startX=zr(c.startX)),0!==c.startY&&(b.startY=zr(c.startY)),0!==c.endX&&(b.endX=zr(c.endX)),0!==c.endY&&(b.endY=zr(c.endY)),c.spot1.A(Hc)||(b.spot1=c.spot1),c.spot2.A(Sc)||(b.spot2=c.spot2),c.type===Gd&&(b.path=Ld(c));else if(c instanceof E)b={"class":"go.EnumValue",classType:vr(a,c.classType),name:c.name};else if(F&&null!==yr(vr(a,c)))return Ca("ERROR: trying to convert a GraphObject or Diagram or Model or Tool or Layout or UndoManager or other unknown data into JSON text: "+c.toString()),"{}";
d="{";c=!0;for(var e in b){var f=Gn(b,e);if(!rr(e,f))if(c?c=!1:d+=", ",d+='"'+e+'":',"points"===e&&f instanceof H){var g="[";for(f=f.iterator;f.next();){var h=f.value;1<g.length&&(g+=",");g+=a.nn(h.x);g+=",";g+=a.nn(h.y)}g+="]";d+=g}else d+=a.nn(f)}return d+"}"}function xr(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)}t.Sh=function(a){A(a,"function",W,"addChangedListener:listener");this.ov.add(a)};
t.Vk=function(a){A(a,"function",W,"removeChangedListener:listener");this.ov.remove(a)};t.Mt=function(a){this.skipsUndoManager||this.undoManager.ow(a);for(var b=this.ov,c=b.length,d=0;d<c;d++)b.O(d)(a)};t.hb=function(a,b,c,d,e,f,g){Br(this,"",a,b,c,d,e,f,g)};t.g=function(a,b,c,d,e){Br(this,"",He,a,this,b,c,d,e)};t.qu=function(a,b,c,d,e,f){Br(this,"",He,b,a,c,d,e,f)};
function Br(a,b,c,d,e,f,g,h,k){void 0===h&&(h=null);void 0===k&&(k=null);var l=new Ge;l.model=a;l.change=c;l.modelChange=b;l.propertyName=d;l.object=e;l.oldValue=f;l.oldParam=h;l.newValue=g;l.newParam=k;a.Mt(l)}
W.prototype.changeState=function(a,b){if(null!==a&&a.model===this)if(a.change===He){var c=a.object,d=a.propertyName,e=a.K(b);d===this.nodeKeyProperty&&this.$a(c)&&(b=a.K(!b),void 0!==b&&this.ab.remove(b),void 0!==e&&this.ab.add(e,c));fk(c,d,e)}else a.change===Je?(c=a.newParam,"nodeDataArray"===a.modelChange?(a=a.newValue,Fa(a)&&"number"===typeof c&&(d=this.pa(a),b?(this.wc[c]===a&&Ka(this.wc,c),void 0!==d&&this.ab.remove(d)):(this.wc[c]!==a&&Ja(this.wc,c,a),void 0!==d&&this.ab.add(d,a)))):""===a.modelChange?
((d=a.object)&&!Ga(d)&&a.propertyName&&(d=Gn(a.object,a.propertyName)),Ga(d)&&"number"===typeof c&&(a=a.newValue,b?Ka(d,c):Ja(d,c,a))):v("unknown ChangedEvent.Insert modelChange: "+a.toString())):a.change===Ke?(c=a.oldParam,"nodeDataArray"===a.modelChange?(a=a.oldValue,Fa(a)&&"number"===typeof c&&(d=this.pa(a),b?(this.wc[c]!==a&&Ja(this.wc,c,a),void 0!==d&&this.ab.add(d,a)):(this.wc[c]===a&&Ka(this.wc,c),void 0!==d&&this.ab.remove(d)))):""===a.modelChange?((d=a.object)&&!Ga(d)&&a.propertyName&&(d=
Gn(a.object,a.propertyName)),Ga(d)&&"number"===typeof c&&(a=a.oldValue,b?Ja(d,c,a):Ka(d,c))):v("unknown ChangedEvent.Remove modelChange: "+a.toString())):a.change!==Ie&&v("unknown ChangedEvent: "+a.toString())};W.prototype.Ca=function(a){return this.undoManager.Ca(a)};W.prototype.bb=function(a){return this.undoManager.bb(a)};W.prototype.Tf=function(){return this.undoManager.Tf()};
W.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Ca(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.bb(b):this.undoManager.Tf(),this.skipsUndoManager=c}};t=W.prototype;t.Ha=function(a,b){void 0===b&&(b="");Br(this,"SourceChanged",Ie,b,a,null,null)};function Cr(a,b,c){"string"!==typeof a&&"function"!==typeof a&&xa(a,"string or function",b,c)}
t.pa=function(a){if(null!==a){var b=this.Xi;if(""!==b&&(b=Gn(a,b),void 0!==b)){if(br(b))return b;v("Key value for node data "+a+" is not a number or a string: "+b)}}};
t.hn=function(a,b){void 0!==b&&null!==b&&br(b)||xa(b,"number or string",W,"setKeyForNodeData:key");if(null!==a){var c=this.Xi;if(""!==c)if(this.$a(a)){var d=Gn(a,c);d!==b&&null===this.Qb(b)&&(fk(a,c,b),void 0!==d&&this.ab.remove(d),this.ab.add(b,a),Br(this,"nodeKey",He,c,a,d,b),"string"===typeof c&&this.Ha(a,c),this.qr(d,b))}else fk(a,c,b)}};function br(a){return"number"===typeof a||"string"===typeof a}t.$a=function(a){var b=this.pa(a);return void 0===b?!1:this.ab.K(b)===a};
t.Qb=function(a){null===a&&v("Model.findNodeDataForKey:key must not be null");return void 0!==a&&br(a)?this.ab.K(a):null};
t.ku=function(a){if(null!==a){var b=this.Xi;if(""!==b){var c=this.pa(a);if(void 0===c||this.ab.contains(c)){var d=this.Wl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.ab.contains(c))){fk(a,b,c);return}if("string"===typeof c){for(d=2;this.ab.contains(c+d);)d++;fk(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.ab.count-1;this.ab.contains(c);)c--;fk(a,b,c)}else F&&v("Model.getKeyForNodeData returned something other than a string or a number: "+c)}}}};
t.Gf=function(a){null!==a&&(ub(a),this.$a(a)||Uq(this,a,!0))};function Uq(a,b,c){var d=a.pa(b);if(void 0===d||a.ab.K(d)!==b)a.ku(b),d=a.pa(b),void 0===d?v("Model.makeNodeDataKeyUnique failed on "+b+".  Data not added to Model."):(a.ab.add(d,b),d=null,c&&(d=a.wc.length,Ja(a.wc,d,b)),Br(a,"nodeDataArray",Je,"nodeDataArray",a,null,b,null,d),a.cn(b),a.bn(b))}t.Cz=function(a){if(Ga(a))for(var b=a.length,c=0;c<b;c++)this.Gf(a[c]);else for(a=a.iterator;a.next();)this.Gf(a.value)};
t.$m=function(a){null!==a&&Tq(this,a,!0)};function Tq(a,b,c){var d=a.pa(b);void 0!==d&&a.ab.remove(d);d=null;if(c){a:if(c=a.wc,Array.isArray(c))d=c.indexOf(b);else{d=c.length;for(var e=0;e<d;e++)if(c[e]===b){d=e;break a}d=-1}if(0>d)return;Ka(a.wc,d)}Br(a,"nodeDataArray",Ke,"nodeDataArray",a,b,null,d,null);a.yr(b)}t.jB=function(a){if(Ga(a))for(var b=a.length,c=0;c<b;c++)this.$m(a[c]);else for(a=a.iterator;a.next();)this.$m(a.value)};
t.$A=function(a){if(a!==this.nodeDataArray&&Ga(a)){var b=this.Yi;b.clear();b.addAll(this.ab.iteratorKeys);var c=this.Vi;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.pa(f);if(void 0!==g){c.add(g);var h=this.Qb(g);h!==f&&(null!==h?(this.Gq(h,f),this.jn(f,h)):(f=this.cloneDeep(f),this.hn(f,g),this.Gf(f)))}else g=this.cloneDeep(f),this.Gf(g),c.add(this.pa(g))}for(a=b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.Qb(d))&&this.$m(d);b.clear();c.clear()}};
t.qr=function(a,b){void 0!==b&&(a=er(this,a),a instanceof I&&this.dg.add(b,a))};t.gx=function(){};t.cn=function(){};t.bn=function(){};t.yr=function(){};function gr(a,b,c){if(void 0!==b){var d=a.dg.K(b);null===d&&(d=new I,a.dg.add(b,d));d.add(c)}}function fr(a,b,c){if(void 0!==b){var d=a.dg.K(b);d instanceof I&&(void 0===c||null===c?a.dg.remove(b):(d.remove(c),0===d.count&&a.dg.remove(b)))}}function er(a,b){if(void 0===b)return null;a=a.dg.K(b);return a instanceof I?a:null}
t.Oz=function(a){void 0===a?this.dg.clear():this.dg.remove(a)};W.prototype.copyNodeData=function(a){if(null===a)return null;var b=this.nl;a=null!==b?b(a,this):Dr(this,a,!0);Fa(a)&&fb(a);return a};
function Dr(a,b,c){if(a.copiesArrays&&Array.isArray(b)){var d=[];for(c=0;c<b.length;c++){var e=Dr(a,b[c],a.copiesArrayObjects);d.push(e)}fb(d);return d}if(c&&Fa(b)){c=(c=b.constructor)?new c:{};e=a.copiesKey||"string"!==typeof a.nodeKeyProperty?null:a.nodeKeyProperty;for(d in b)if("__gohashid"===d)c.__gohashid=void 0;else if(d===e)c[e]=void 0;else{var f=Gn(b,d);var g=vr(a,f);"GraphObject"===g||"Diagram"===g||"Layer"===g||"RowColumnDefinition"===g||"AnimationManager"===g||"Tool"===g||"CommandHandler"===
g||"Layout"===g||"InputEvent"===g||"DiagramEvent"===g?(F&&"_"!==d[0]&&Ca('Warning: found GraphObject or Diagram reference when copying model data on property "'+d+'" of data object: '+b.toString()+"  \nModel data should not have any references to a Diagram or any part of a diagram, such as: "+f.toString()),g=!0):g=f instanceof W||f instanceof Me||f instanceof Le||f instanceof Ge?!0:!1;g?fk(c,d,f):(f=Dr(a,f,!1),fk(c,d,f))}fb(c);return c}return b instanceof J?b.copy():b instanceof Hb?b.copy():b instanceof
L?b.copy():b instanceof M?b.copy():b instanceof lc?b.copy():b}
W.prototype.setDataProperty=function(a,b,c){F&&(A(a,"object",W,"setDataProperty:data"),A(b,"string",W,"setDataProperty:propname"),""===b&&v("Model.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.$a(a)){if(b===this.nodeKeyProperty){this.hn(a,c);return}if(b===this.nodeCategoryProperty){this.gn(a,c);return}}else!Er&&a instanceof N&&(Er=!0,Ca('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),Ca("  Is that really your intent?"));var d=
Gn(a,b);d!==c&&(fk(a,b,c),this.qu(a,b,d,c))};t=W.prototype;t.set=function(a,b,c){this.setDataProperty(a,b,c)};t.Gq=function(a,b){if(b){var c=this.$a(a),d;for(d in b)"__gohashid"===d||c&&d===this.nodeKeyProperty||this.setDataProperty(a,d,b[d])}};t.zz=function(a,b){this.bu(a,-1,b)};
t.bu=function(a,b,c){F&&(Ha(a,W,"insertArrayItem:arr"),C(b,W,"insertArrayItem:idx"),a===this.wc&&v("Model.insertArrayItem or Model.addArrayItem should not be called on the Model.nodeDataArray"));0>b&&(b=a.length);Ja(a,b,c);Br(this,"",Je,"",a,null,c,null,b)};
t.Ew=function(a,b){void 0===b&&(b=-1);F&&(Ha(a,W,"removeArrayItem:arr"),C(b,W,"removeArrayItem:idx"));a===this.wc&&v("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=a.length-1);var c=a[b];Ka(a,b);Br(this,"",Ke,"",a,c,null,b,null)};t.Tq=function(a){if(null===a)return"";var b=this.gk;if(""===b)return"";b=Gn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;v("getCategoryForNodeData found a non-string category for "+a+": "+b);return""};
t.gn=function(a,b){A(b,"string",W,"setCategoryForNodeData:cat");if(null!==a){var c=this.gk;if(""!==c)if(this.$a(a)){var d=Gn(a,c);void 0===d&&(d="");d!==b&&(fk(a,c,b),Br(this,"nodeCategory",He,c,a,d,b))}else fk(a,c,b)}};t.jn=function(a,b){this.gn(b,this.Tq(a))};t.Om=function(){return!1};t.Jk=function(){return!1};t.Bj=function(){return!1};t.hu=function(){return!1};t.zj=function(){return!1};function Ki(){return new W}
function vr(a,b){if("function"===typeof b){if(b.className)return b.className;if(b.name)return b.name}else if("object"===typeof b&&null!==b&&b.constructor)return vr(a,b.constructor);return typeof b}function yr(a){return Fr[a]?Fr[a]:void 0!==qa.go&&qa.go[a]?qa.go[a]:null}function Gn(a,b){if(!a||!b)return null;try{if("function"===typeof b)var c=b(a);else"function"===typeof a.getAttribute?(c=a.getAttribute(b),null===c&&(c=void 0)):c=a[b]}catch(d){F&&Ca("property get error: "+d.toString())}return c}
function fk(a,b,c){if(a&&b)try{"function"===typeof b?b(a,c):"function"===typeof a.setAttribute?a.setAttribute(b,c):a[b]=c}catch(d){F&&Ca("property set error: "+d.toString())}}
ma.Object.defineProperties(W.prototype,{name:{configurable:!0,get:function(){return this.Wa},set:function(a){var b=this.Wa;b!==a&&(A(a,"string",W,"name"),this.Wa=a,this.g("name",b,a))}},dataFormat:{configurable:!0,get:function(){return this.Xn},set:function(a){var b=this.Xn;b!==a&&(A(a,"string",W,"dataFormat"),this.Xn=a,this.g("dataFormat",b,a))}},isReadOnly:{configurable:!0,get:function(){return this.lg},set:function(a){var b=this.lg;b!==a&&(A(a,"boolean",
W,"isReadOnly"),this.lg=a,this.g("isReadOnly",b,a))}},modelData:{configurable:!0,get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(A(a,"object",W,"modelData"),this.l=a,this.g("modelData",b,a),this.Ha(a))}},undoManager:{configurable:!0,get:function(){return this.w},set:function(a){var b=this.w;b!==a&&(x(a,Me,W,"undoManager"),null!==b&&b.bz(this),this.w=a,null!==a&&a.ky(this))}},skipsUndoManager:{configurable:!0,get:function(){return this.Gg},
set:function(a){A(a,"boolean",W,"skipsUndoManager");this.Gg=a}},nodeKeyProperty:{configurable:!0,get:function(){return this.Xi},set:function(a){var b=this.Xi;b!==a&&(Cr(a,W,"nodeKeyProperty"),""===a&&v("Model.nodeKeyProperty may not be the empty string"),0<this.ab.count&&v("Cannot set Model.nodeKeyProperty when there is existing node data"),this.Xi=a,this.g("nodeKeyProperty",b,a))}},makeUniqueKeyFunction:{configurable:!0,get:function(){return this.Wl},set:function(a){var b=
this.Wl;b!==a&&(null!==a&&A(a,"function",W,"makeUniqueKeyFunction"),this.Wl=a,this.g("makeUniqueKeyFunction",b,a))}},nodeDataArray:{configurable:!0,get:function(){return this.wc},set:function(a){var b=this.wc;if(b!==a){Ha(a,W,"nodeDataArray");this.ab.clear();this.gx();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!Fa(e)){v("Model.nodeDataArray must only contain Objects, not: "+e);return}ub(e)}this.wc=a;d=new H;for(e=0;e<c;e++){var f=a[e],g=this.pa(f);void 0===g?d.add(f):null!==this.ab.K(g)?
d.add(f):this.ab.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.ku(e),f=this.pa(e),void 0!==f&&this.ab.add(f,e);Br(this,"nodeDataArray",He,"nodeDataArray",this,b,a);for(b=0;b<c;b++)d=a[b],this.cn(d),this.bn(d);Array.isArray(a)||(this.isReadOnly=!0)}}},copyNodeDataFunction:{configurable:!0,get:function(){return this.nl},set:function(a){var b=this.nl;b!==a&&(null!==a&&A(a,"function",W,"copyNodeDataFunction"),this.nl=a,this.g("copyNodeDataFunction",b,a))}},copiesArrays:{configurable:!0,
enumerable:!0,get:function(){return this.Pn},set:function(a){var b=this.Pn;b!==a&&(null!==a&&A(a,"boolean",W,"copiesArrays"),this.Pn=a,this.g("copiesArrays",b,a))}},copiesArrayObjects:{configurable:!0,get:function(){return this.On},set:function(a){var b=this.On;b!==a&&(null!==a&&A(a,"boolean",W,"copiesArrayObjects"),this.On=a,this.g("copiesArrayObjects",b,a))}},copiesKey:{configurable:!0,get:function(){return this.Rn},set:function(a){var b=this.Rn;b!==a&&(null!==a&&A(a,
"boolean",W,"copiesKey"),this.Rn=a,this.g("copiesKey",b,a))}},afterCopyFunction:{configurable:!0,get:function(){return this.vn},set:function(a){var b=this.vn;b!==a&&(null!==a&&A(a,"function",W,"afterCopyFunction"),this.vn=a,this.g("afterCopyFunction",b,a))}},nodeCategoryProperty:{configurable:!0,get:function(){return this.gk},set:function(a){var b=this.gk;b!==a&&(Cr(a,W,"nodeCategoryProperty"),this.gk=a,this.g("nodeCategoryProperty",b,a))}},type:{configurable:!0,
get:function(){return"Model"}}});W.prototype.setCategoryForNodeData=W.prototype.gn;W.prototype.getCategoryForNodeData=W.prototype.Tq;W.prototype.removeArrayItem=W.prototype.Ew;W.prototype.insertArrayItem=W.prototype.bu;W.prototype.addArrayItem=W.prototype.zz;W.prototype.assignAllDataProperties=W.prototype.Gq;W.prototype.set=W.prototype.set;W.prototype.clearUnresolvedReferences=W.prototype.Oz;W.prototype.mergeNodeDataArray=W.prototype.$A;W.prototype.removeNodeDataCollection=W.prototype.jB;
W.prototype.removeNodeData=W.prototype.$m;W.prototype.addNodeDataCollection=W.prototype.Cz;W.prototype.addNodeData=W.prototype.Gf;W.prototype.makeNodeDataKeyUnique=W.prototype.ku;W.prototype.findNodeDataForKey=W.prototype.Qb;W.prototype.containsNodeData=W.prototype.$a;W.prototype.setKeyForNodeData=W.prototype.hn;W.prototype.getKeyForNodeData=W.prototype.pa;W.prototype.updateTargetBindings=W.prototype.Ha;W.prototype.commit=W.prototype.commit;W.prototype.rollbackTransaction=W.prototype.Tf;
W.prototype.commitTransaction=W.prototype.bb;W.prototype.startTransaction=W.prototype.Ca;W.prototype.raiseDataChanged=W.prototype.qu;W.prototype.raiseChanged=W.prototype.g;W.prototype.raiseChangedEvent=W.prototype.hb;W.prototype.removeChangedListener=W.prototype.Vk;W.prototype.addChangedListener=W.prototype.Sh;W.prototype.writeJsonValue=W.prototype.nn;W.prototype.replaceJsonObjects=W.prototype.an;W.prototype.applyIncrementalJSON=W.prototype.Gz;W.prototype.applyIncrementalJson=W.prototype.my;
W.prototype.toJSON=W.prototype.toJSON;W.prototype.toJson=W.prototype.wr;W.prototype.toIncrementalJSON=W.prototype.uB;W.prototype.toIncrementalJson=W.prototype.kz;W.prototype.computeJsonDifference=W.prototype.Pz;W.prototype.toIncrementalData=W.prototype.tB;W.prototype.clear=W.prototype.clear;var Er=!1,Fr={};W.className="Model";
W.fromJSON=W.fromJson=function(a,b){void 0===b&&(b=null);null!==b&&x(b,W,W,"fromJson:model");var c=null;if("string"===typeof a)try{c=qa.JSON.parse(a)}catch(f){F&&Ca("JSON.parse error: "+f.toString())}else"object"===typeof a?c=a:v("Unable to construct a Model from: "+a);if(null===b){a=null;var d=c["class"];if("string"===typeof d)try{var e=null;0===d.indexOf("go.")?(d=d.substr(3),e=yr(d)):(e=yr(d),null===e&&(e=qa[d]));"function"===typeof e&&(a=new e)}catch(f){}null===a||a instanceof W?b=a:v("Unable to construct a Model of declared class: "+
c["class"])}null===b&&(b=W.constructGraphLinksModel());b.lr(c);b.Cw(c);return b};W.safePropertyValue=Gn;W.safePropertySet=fk;Fr.Brush=Hl;Fr.ChangedEvent=Ge;Fr.Geometry=Fd;Fr.Margin=lc;Fr.Panel=V;Fr.Point=J;Fr.Rect=L;Fr.Size=Hb;Fr.Spot=M;Fr.Transaction=Le;Fr.UndoManager=Me;
function Yi(a,b,c){fb(this);this.s=!1;void 0===a?a="":A(a,"string",Yi,"constructor:targetprop");void 0===b?b=a:A(b,"string",Yi,"constructor:sourceprop");void 0===c?c=null:null!==c&&A(c,"function",Yi,"constructor:conv");this.l=-1;this.pd=null;this.wm=a;this.vm=this.sq=0;this.ut=null;this.Jo=!1;this.om=b;this.Nn=c;this.ip=Gr;this.Gn=null;this.$u=new I}
Yi.prototype.copy=function(){var a=new Yi;a.wm=this.wm;a.sq=this.sq;a.vm=this.vm;a.ut=this.ut;a.Jo=this.Jo;a.om=this.om;a.Nn=this.Nn;a.ip=this.ip;a.Gn=this.Gn;return a};t=Yi.prototype;t.nb=function(a){a.classType===Yi?this.mode=a:Ba(this,a)};t.toString=function(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(-1!==this.Hj?" "+this.Hj:"")+" "+this.mode.name+")"};t.freeze=function(){this.s=!0;return this};t.ka=function(){this.s=!1;return this};
t.Vy=function(a){void 0===a&&(a=null);null!==a&&A(a,"function",Yi,"makeTwoWay");this.mode=yn;this.backConverter=a;return this};t.hr=function(a){void 0===a&&(a="");F&&A(a,"string",Yi,"ofObject:srcname");this.sourceName=a;this.isToModel=!1;return this};t.bB=function(){this.sourceName=null;this.isToModel=!0;return this};function ul(a,b,c){a=a.sourceName;return null===a||""===a?b:"/"===a?c.part:"."===a?c:".."===a?c.panel:b.gb(a)}
t.hx=function(a,b,c){var d=this.om;if(void 0===c||""===d||d===c){c=this.wm;var e=this.Nn;if(null===e&&""===c)Ca("Binding error: target property is the empty string: "+this.toString());else{F&&"string"===typeof c&&("function"!==typeof a.setAttribute&&0<c.length&&"_"!==c[0]&&!Ra(a,c)?Ca("Binding error: undefined target property: "+c+" on "+a.toString()):"name"===c&&a instanceof N&&Ca("Binding error: cannot modify GraphObject.name on "+a.toString()));var f=b;""!==d&&(f=Gn(b,d));if(void 0!==f)if(null===
e)""!==c&&fk(a,c,f);else try{if(""!==c){var g=e(f,a);F&&void 0===g&&Ca('Binding warning: conversion function returned undefined when setting target property "'+c+'" on '+a.toString()+", function is: "+e);fk(a,c,g)}else e(f,a)}catch(h){F&&Ca("Binding error: "+h.toString()+' setting target property "'+c+'" on '+a.toString()+" with conversion function: "+e)}}}};
t.Ar=function(a,b,c,d){if(this.ip===yn){var e=this.wm;if(void 0===c||e===c){c=this.om;var f=this.Gn,g=a;""!==e&&(g=Gn(a,e));if(void 0!==g&&!this.$u.contains(a))try{this.$u.add(a);var h=null!==d?d.diagram:null,k=null!==h?h.model:null;if(null===f)if(""!==c)null!==k?(F&&k.nodeKeyProperty===c&&k.$a(b)&&Ca("Binding error: cannot have TwoWay Binding on node data key property: "+this.toString()),k.setDataProperty(b,c,g)):fk(b,c,g);else{if(null!==k&&null!==d&&0<=d.itemIndex&&null!==d.panel&&Array.isArray(d.panel.itemArray)){var l=
d.itemIndex,m=d.panel.itemArray;k.Ew(m,l);k.bu(m,l,g)}}else try{if(""!==c){var n=f(g,b,k);null!==k?(F&&(k.nodeKeyProperty===c&&k.$a(b)&&Ca("Binding error: cannot have TwoWay Binding on node data key property: "+this.toString()),void 0===n&&Ca('Binding warning: conversion function returned undefined when setting source property "'+c+'" on '+b.toString()+", function is: "+f)),k.setDataProperty(b,c,n)):fk(b,c,n)}else{var p=f(g,b,k);if(void 0!==p&&null!==k&&null!==d&&0<=d.itemIndex&&null!==d.panel&&Array.isArray(d.panel.itemArray)){var r=
d.itemIndex,q=d.panel.itemArray;k.Ew(q,r);k.bu(q,r,p)}}}catch(u){F&&Ca("Binding error: "+u.toString()+' setting source property "'+c+'" on '+b.toString()+" with conversion function: "+f)}}finally{this.$u.remove(a)}}}};
ma.Object.defineProperties(Yi.prototype,{Hj:{configurable:!0,get:function(){return this.l},set:function(a){this.s&&va(this);A(a,"number",Yi,"targetId");this.l=a}},targetProperty:{configurable:!0,get:function(){return this.wm},set:function(a){this.s&&va(this);A(a,"string",Yi,"targetProperty");this.wm=a}},sourceName:{configurable:!0,get:function(){return this.ut},set:function(a){this.s&&va(this);null!==a&&A(a,"string",Yi,"sourceName");this.ut=a;null!==a&&(this.Jo=
!1)}},isToModel:{configurable:!0,get:function(){return this.Jo},set:function(a){this.s&&va(this);A(a,"boolean",Yi,"isToModel");this.Jo=a}},sourceProperty:{configurable:!0,get:function(){return this.om},set:function(a){this.s&&va(this);A(a,"string",Yi,"sourceProperty");this.om=a}},converter:{configurable:!0,get:function(){return this.Nn},set:function(a){this.s&&va(this);null!==a&&A(a,"function",Yi,"converter");this.Nn=a}},backConverter:{configurable:!0,
get:function(){return this.Gn},set:function(a){this.s&&va(this);null!==a&&A(a,"function",Yi,"backConverter");this.Gn=a}},mode:{configurable:!0,get:function(){return this.ip},set:function(a){this.s&&va(this);hb(a,Yi,Yi,"mode");this.ip=a}}});Yi.prototype.updateSource=Yi.prototype.Ar;Yi.prototype.updateTarget=Yi.prototype.hx;Yi.prototype.ofModel=Yi.prototype.bB;Yi.prototype.ofObject=Yi.prototype.hr;Yi.prototype.makeTwoWay=Yi.prototype.Vy;
var Gr=new E(Yi,"OneWay",1),yn=new E(Yi,"TwoWay",2);Yi.className="Binding";Yi.parseEnum=function(a,b){A(a,"function",Yi,"parseEnum:ctor");hb(b,a,Yi,"parseEnum:defval");return function(c){c=gb(a,c);return null===c?b:c}};Yi.toString=Qa;Yi.OneWay=Gr;Yi.TwoWay=yn;
function Hr(a,b){W.call(this);this.Eu=',\n  "insertedLinkKeys": ';this.xx=',\n  "modifiedLinkData": ';this.Gu=',\n  "removedLinkKeys": ';F&&2<arguments.length&&v("GraphLinksModel constructor can only take two optional arguments, the Array of node data and the Array of link data.");this.bd=[];this.mg=new I;this.lb=new Db;this.Ri="";this.Jj=this.ml=this.Xl=null;this.mf="from";this.nf="to";this.dk=this.ck="";this.bk="category";this.Zd="";this.am="isGroup";this.Ge="group";this.Qn=!1;void 0!==a&&(this.nodeDataArray=
a);void 0!==b&&(this.linkDataArray=b)}la(Hr,W);Hr.constructGraphLinksModel=W.constructGraphLinksModel;Hr.prototype.cloneProtected=function(a){W.prototype.cloneProtected.call(this,a);a.Ri=this.Ri;a.Xl=this.Xl;a.ml=this.ml;a.mf=this.mf;a.nf=this.nf;a.ck=this.ck;a.dk=this.dk;a.bk=this.bk;a.Zd=this.Zd;a.am=this.am;a.Ge=this.Ge;a.Qn=this.Qn};t=Hr.prototype;t.clear=function(){W.prototype.clear.call(this);this.bd=[];this.lb.clear();this.mg.clear()};
t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.wr();var b=(""!==this.name?this.name:"")+" GraphLinksModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;var c=a.length,d;for(d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+Qa(e)}b+="\n link data:";a=this.linkDataArray;c=a.length;for(d=0;d<c;d++)e=a[d],b+=" "+$q(this,e,!0)+"--\x3e"+$q(this,e,!1)}return b};
t.mx=function(a,b){""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalData() to succeed.");var c=W.prototype.mx.call(this,a,b),d=this,e=new I,f=new I,g=new I,h=this.ii;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===Je?e.add(a.newValue):a.change===Ke&&g.add(a.oldValue):d.Cc(a.object)?f.add(a.object):null!==a.object&&(null!==a.object&&h&&h.contains(a.object)?h.get(a.object).each(function(a){d.Cc(a)&&f.add(a)}):
a.object instanceof W||d.$a(a.object)||Ir(d,a.object).each(function(a){f.add(a)})))});var k=this.Vi;k.clear();e.each(function(a){k.add(d.ac(a));b||f.add(a)});var l=this.Yi;l.clear();g.each(function(a){l.add(d.ac(a));b&&f.add(a)});a=d.cloneDeep(f.ta());0<k.count&&(null===c&&(c={}),b?c.removedLinkKeys=k.ta():c.insertedLinkKeys=k.ta());0<a.length&&(null===c&&(c={}),c.modifiedLinkData=a);0<l.count&&(null===c&&(c={}),b?c.insertedLinkKeys=l.ta():c.removedLinkKeys=l.ta());l.clear();k.clear();return c};
t.Zk=function(){var a=W.prototype.Zk.call(this),b="";"category"!==this.linkCategoryProperty&&"string"===typeof this.linkCategoryProperty&&(b+=',\n  "linkCategoryProperty": '+this.quote(this.linkCategoryProperty));""!==this.linkKeyProperty&&"string"===typeof this.linkKeyProperty&&(b+=',\n  "linkKeyProperty": '+this.quote(this.linkKeyProperty));"from"!==this.linkFromKeyProperty&&"string"===typeof this.linkFromKeyProperty&&(b+=',\n  "linkFromKeyProperty": '+this.quote(this.linkFromKeyProperty));"to"!==
this.linkToKeyProperty&&"string"===typeof this.linkToKeyProperty&&(b+=',\n  "linkToKeyProperty": '+this.quote(this.linkToKeyProperty));""!==this.linkFromPortIdProperty&&"string"===typeof this.linkFromPortIdProperty&&(b+=',\n  "linkFromPortIdProperty": '+this.quote(this.linkFromPortIdProperty));""!==this.linkToPortIdProperty&&"string"===typeof this.linkToPortIdProperty&&(b+=',\n  "linkToPortIdProperty": '+this.quote(this.linkToPortIdProperty));""!==this.linkLabelKeysProperty&&"string"===typeof this.linkLabelKeysProperty&&
(b+=',\n  "linkLabelKeysProperty": '+this.quote(this.linkLabelKeysProperty));"isGroup"!==this.nodeIsGroupProperty&&"string"===typeof this.nodeIsGroupProperty&&(b+=',\n  "nodeIsGroupProperty": '+this.quote(this.nodeIsGroupProperty));"group"!==this.nodeGroupKeyProperty&&"string"===typeof this.nodeGroupKeyProperty&&(b+=',\n  "nodeGroupKeyProperty": '+this.quote(this.nodeGroupKeyProperty));return a+b};
t.lr=function(a){W.prototype.lr.call(this,a);a.linkKeyProperty&&(this.linkKeyProperty=a.linkKeyProperty);a.linkFromKeyProperty&&(this.linkFromKeyProperty=a.linkFromKeyProperty);a.linkToKeyProperty&&(this.linkToKeyProperty=a.linkToKeyProperty);a.linkFromPortIdProperty&&(this.linkFromPortIdProperty=a.linkFromPortIdProperty);a.linkToPortIdProperty&&(this.linkToPortIdProperty=a.linkToPortIdProperty);a.linkCategoryProperty&&(this.linkCategoryProperty=a.linkCategoryProperty);a.linkLabelKeysProperty&&(this.linkLabelKeysProperty=
a.linkLabelKeysProperty);a.nodeIsGroupProperty&&(this.nodeIsGroupProperty=a.nodeIsGroupProperty);a.nodeGroupKeyProperty&&(this.nodeGroupKeyProperty=a.nodeGroupKeyProperty)};t.nx=function(){var a=W.prototype.nx.call(this),b=',\n  "linkDataArray": '+sr(this,this.linkDataArray,!0);return a+b};t.Cw=function(a){W.prototype.Cw.call(this,a);a=a.linkDataArray;Array.isArray(a)&&(this.an(a),this.linkDataArray=a)};
t.Br=function(a){if(!(a instanceof Hr))return v("Model.computeJsonDifference: newmodel must be a GraphLinksModel"),"";""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .computeJsonDifference() to succeed.");var b=W.prototype.Br.call(this,a);ur(this,a,"linkKeyProperty");ur(this,a,"linkFromKeyProperty");ur(this,a,"linkToKeyProperty");ur(this,a,"linkLabelKeysProperty");ur(this,a,"nodeIsGroupProperty");ur(this,a,"nodeGroupKeyProperty");var c=this.Vi;c.clear();
var d=new I,e=this.Yi;e.clear();e.addAll(this.lb.iteratorKeys);for(var f=new Db,g=a.linkDataArray,h=g.length,k=0;k<h;k++){var l=g[k],m=a.ac(l);if(void 0!==m){e.remove(m);var n=this.Pg(m);null===n?(c.add(m),d.add(l)):tr(this,n,l,f)||d.add(l)}else this.er(l),m=this.ac(l),c.add(m),d.add(l)}a=b;0<c.count&&(a+=this.Eu+sr(this,c.ta(),!0));0<d.count&&(a+=this.xx+sr(this,d.ta(),!0));0<e.count&&(a+=this.Gu+sr(this,e.ta(),!0));e.clear();c.clear();return a};
function Ir(a,b){for(var c=new I,d=0;d<a.linkDataArray.length;d++){var e=a.linkDataArray[d];wr(a,b,e,e,c)}return c}
t.lx=function(a,b){""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.");var c=W.prototype.lx.call(this,a,b),d=this,e=new I,f=new I,g=new I,h=this.ii;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===Je?e.add(a.newValue):a.change===Ke&&g.add(a.oldValue):d.Cc(a.object)?f.add(a.object):null!==a.object&&(null!==a.object&&h&&h.contains(a.object)?h.get(a.object).each(function(a){d.Cc(a)&&f.add(a)}):
a.object instanceof W||d.$a(a.object)||Ir(d,a.object).each(function(a){f.add(a)})))});var k=this.Vi;k.clear();e.each(function(a){k.add(d.ac(a));b||f.add(a)});var l=this.Yi;l.clear();g.each(function(a){l.add(d.ac(a));b&&f.add(a)});a=c;0<k.count&&(a+=(b?this.Gu:this.Eu)+sr(this,k.ta(),!0));0<f.count&&(a+=this.xx+sr(this,f.ta(),!0));0<l.count&&(a+=(b?this.Eu:this.Gu)+sr(this,l.ta(),!0));l.clear();k.clear();return a};
t.kr=function(a){(void 0!==a.linkCategoryProperty&&a.linkCategoryProperty!==this.linkCategoryProperty||void 0!==a.linkKeyProperty&&a.linkKeyProperty!==this.linkKeyProperty||void 0!==a.linkFromKeyProperty&&a.linkFromKeyProperty!==this.linkFromKeyProperty||void 0!==a.linkToKeyProperty&&a.linkToKeyProperty!==this.linkToKeyProperty||void 0!==a.linkFromPortIdProperty&&a.linkFromPortIdProperty!==this.linkFromPortIdProperty||void 0!==a.linkToPortIdProperty&&a.linkToPortIdProperty!==this.linkToPortIdProperty||
void 0!==a.linkLabelKeysProperty&&a.linkLabelKeysProperty!==this.linkLabelKeysProperty||void 0!==a.nodeIsGroupProperty&&a.nodeIsGroupProperty!==this.nodeIsGroupProperty||void 0!==a.nodeGroupKeyProperty&&a.nodeGroupKeyProperty!==this.nodeGroupKeyProperty)&&v("applyIncrementalJson cannot change Model properties");W.prototype.kr.call(this,a);var b=a.insertedLinkKeys;if(Array.isArray(b))for(var c=b.length,d=0;d<c;d++){var e=b[d],f=this.Pg(e);null===f&&(f=this.Lq({}),this.vu(f,e),this.mj(f))}b=a.modifiedLinkData;
if(Array.isArray(b))for(c=b.length,d=0;d<c;d++)if(e=b[d],f=this.ac(e),f=this.Pg(f),null!==f){for(var g in e)"__gohashid"!==g&&g!==this.linkKeyProperty&&this.setDataProperty(f,g,e[g]);Jr(this,e,f)}a=a.removedLinkKeys;if(Array.isArray(a))for(g=a.length,b=0;b<g;b++)c=this.Pg(a[b]),null!==c&&this.Zm(c)};
Hr.prototype.changeState=function(a,b){if(null!==a&&a.model===this){if(a.change===He){var c=a.object,d=a.propertyName;if(d===this.linkKeyProperty&&this.Cc(c)){var e=a.K(b);b=a.K(!b);void 0!==b&&this.lb.remove(b);void 0!==e&&this.lb.add(e,c);fk(c,d,e);return}}else if(a.change===Je){c=a.newParam;if("linkDataArray"===a.modelChange){a=a.newValue;Fa(a)&&"number"===typeof c&&(d=this.ac(a),b?(this.mg.remove(a),this.bd[c]===a&&this.bd.splice(c,1),void 0!==d&&this.lb.remove(d)):(this.mg.add(a),this.bd[c]!==
a&&this.bd.splice(c,0,a),void 0!==d&&this.lb.add(d,a)));return}if("linkLabelKeys"===a.modelChange){d=this.Nf(a.object);Array.isArray(d)&&"number"===typeof c&&(b?(c=d.indexOf(a.newValue),0<=c&&d.splice(c,1)):0>d.indexOf(a.newValue)&&d.splice(c,0,a.newValue));return}}else if(a.change===Ke){c=a.oldParam;if("linkDataArray"===a.modelChange){a=a.oldValue;Fa(a)&&"number"===typeof c&&(d=this.ac(a),b?(this.mg.add(a),this.bd[c]!==a&&this.bd.splice(c,0,a),void 0!==d&&this.lb.add(d,a)):(this.mg.remove(a),this.bd[c]===
a&&this.bd.splice(c,1),void 0!==d&&this.lb.remove(d)));return}if("linkLabelKeys"===a.modelChange){d=this.Nf(a.object);Array.isArray(d)&&"number"===typeof c&&(b?0>d.indexOf(a.newValue)&&d.splice(c,0,a.newValue):(c=d.indexOf(a.newValue),0<=c&&d.splice(c,1)));return}}W.prototype.changeState.call(this,a,b)}};t=Hr.prototype;t.Qm=function(a){if(void 0!==a){var b=this.Jj;if(null!==b){var c=this.Qb(a);null===c&&(c=this.copyNodeData(b),fk(c,this.nodeKeyProperty,a),this.Gf(c))}return a}};
t.Jy=function(a){return $q(this,a,!0)};t.Ow=function(a,b){hr(this,a,b,!0)};t.My=function(a){return $q(this,a,!1)};t.Tw=function(a,b){hr(this,a,b,!1)};function $q(a,b,c){if(null!==b&&(a=c?a.mf:a.nf,""!==a&&(a=Gn(b,a),void 0!==a))){if(br(a))return a;v((c?"FromKey":"ToKey")+" value for link data "+b+" is not a number or a string: "+a)}}
function hr(a,b,c,d){null===c&&(c=void 0);void 0===c||br(c)||xa(c,"number or string",Hr,d?"setFromKeyForLinkData:key":"setToKeyForLinkData:key");if(null!==b){var e=d?a.mf:a.nf;if(""!==e)if(c=a.Qm(c),a.Cc(b)){var f=Gn(b,e);f!==c&&(fr(a,f,b),fk(b,e,c),null===a.Qb(c)&&gr(a,c,b),Br(a,d?"linkFromKey":"linkToKey",He,e,b,f,c),"string"===typeof e&&a.Ha(b,e))}else fk(b,e,c)}}t.Ky=function(a){return Zq(this,a,!0)};t.Pw=function(a,b){ir(this,a,b,!0)};t.Ny=function(a){return Zq(this,a,!1)};
t.Uw=function(a,b){ir(this,a,b,!1)};function Zq(a,b,c){if(null===b)return"";a=c?a.ck:a.dk;if(""===a)return"";b=Gn(b,a);return void 0===b?"":b}function ir(a,b,c,d){A(c,"string",Hr,d?"setFromPortIdForLinkData:portname":"setToPortIdForLinkData:portname");if(null!==b){var e=d?a.ck:a.dk;if(""!==e)if(a.Cc(b)){var f=Gn(b,e);void 0===f&&(f="");f!==c&&(fk(b,e,c),Br(a,d?"linkFromPortId":"linkToPortId",He,e,b,f,c),"string"===typeof e&&a.Ha(b,e))}else fk(b,e,c)}}
t.Nf=function(a){if(null===a)return Kr;var b=this.Zd;if(""===b)return Kr;a=Gn(a,b);return void 0===a?Kr:a};t.wu=function(a,b){Ha(b,Hr,"setLabelKeysForLinkData:arr");if(null!==a){var c=this.Zd;if(""!==c)if(this.Cc(a)){var d=Gn(a,c);void 0===d&&(d=Kr);if(d!==b){if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)fr(this,d[f],a);fk(a,c,b);e=b.length;for(f=0;f<e;f++){var g=b[f];null===this.Qb(g)&&gr(this,g,a)}Br(this,"linkLabelKeys",He,c,a,d,b);"string"===typeof c&&this.Ha(a,c)}}else fk(a,c,b)}};
t.Qv=function(a,b){if(null!==b&&void 0!==b&&(br(b)||xa(b,"number or string",Hr,"addLabelKeyForLinkData:key"),null!==a)){var c=this.Zd;if(""!==c){var d=Gn(a,c);if(void 0===d)c=[],c.push(b),this.wu(a,c);else if(Array.isArray(d)){var e=d.indexOf(b);0<=e||(e=d.length,d.push(b),this.Cc(a)&&(null===this.Qb(b)&&gr(this,b,a),Br(this,"linkLabelKeys",Je,c,a,null,b,null,e)))}else v(c+" property is not an Array; cannot addLabelKeyForLinkData: "+a)}}};
t.az=function(a,b){if(null!==b&&void 0!==b&&(br(b)||xa(b,"number or string",Hr,"removeLabelKeyForLinkData:key"),null!==a)){var c=this.Zd;if(""!==c){var d=Gn(a,c);if(Array.isArray(d)){var e=d.indexOf(b);0>e||(d.splice(e,1),this.Cc(a)&&(fr(this,b,a),Br(this,"linkLabelKeys",Ke,c,a,b,null,e,null)))}else void 0!==d&&v(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}};
t.ac=function(a){if(null!==a){var b=this.Ri;if(""!==b&&(b=Gn(a,b),void 0!==b)){if(br(b))return b;v("Key value for link data "+a+" is not a number or a string: "+b)}}};t.vu=function(a,b){void 0!==b&&null!==b&&br(b)||xa(b,"number or string",Hr,"setKeyForLinkData:key");if(null!==a){var c=this.Ri;if(""!==c)if(this.Cc(a)){var d=Gn(a,c);d!==b&&null===this.Pg(b)&&(fk(a,c,b),void 0!==d&&this.lb.remove(d),this.lb.add(b,a),Br(this,"linkKey",He,c,a,d,b),"string"===typeof c&&this.Ha(a,c))}else fk(a,c,b)}};
t.Pg=function(a){null===a&&v("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&br(a)?this.lb.K(a):null};
t.er=function(a){if(null!==a){var b=this.Ri;if(""!==b){var c=this.ac(a);if(void 0===c||this.lb.contains(c)){var d=this.Xl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.lb.contains(c))){fk(a,b,c);return}if("string"===typeof c){for(d=2;this.lb.contains(c+d);)d++;fk(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.lb.count-1;this.lb.contains(c);)c--;fk(a,b,c)}else F&&v("GraphLinksModel.getKeyForLinkData returned something other than a string or a number: "+c)}}}};
t.Cc=function(a){return null===a?!1:this.mg.contains(a)};t.mj=function(a){null!==a&&(ub(a),this.Cc(a)||dr(this,a,!0))};function dr(a,b,c){if(""!==a.linkKeyProperty){var d=a.ac(b);if(void 0!==d&&a.lb.K(d)===b)return;a.er(b);d=a.ac(b);if(void 0===d){v("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");return}a.lb.add(d,b)}a.mg.add(b);d=null;c&&(d=a.bd.length,a.bd.splice(d,0,b));Br(a,"linkDataArray",Je,"linkDataArray",a,null,b,null,d);Lr(a,b)}
t.Bz=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.mj(a[c]);else for(a=a.iterator;a.next();)this.mj(a.value)};t.Zm=function(a){null!==a&&cr(this,a,!0)};function cr(a,b,c){a.mg.remove(b);var d=a.ac(b);void 0!==d&&a.lb.remove(d);d=null;if(c){d=a.bd.indexOf(b);if(0>d)return;a.bd.splice(d,1)}Br(a,"linkDataArray",Ke,"linkDataArray",a,b,null,d,null);c=$q(a,b,!0);fr(a,c,b);c=$q(a,b,!1);fr(a,c,b);d=a.Nf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],fr(a,c,b)}
t.hB=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.Zm(a[c]);else for(a=a.iterator;a.next();)this.Zm(a.value)};
t.ZA=function(a){""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed.");if(a!==this.linkDataArray&&Ga(a)){var b=this.Yi;b.clear();b.addAll(this.lb.iteratorKeys);var c=this.Vi;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.ac(f);if(void 0!==g){c.add(g);var h=this.Pg(g);h!==f&&(null!==h?(this.Gq(h,f),Jr(this,f,h)):(f=this.cloneDeep(f),this.vu(f,g),this.mj(f)))}else g=this.cloneDeep(f),this.mj(g),c.add(this.ac(g))}for(a=
b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.Pg(d))&&this.Zm(d);b.clear();c.clear()}};function Lr(a,b){var c=$q(a,b,!0);c=a.Qm(c);null===a.Qb(c)&&gr(a,c,b);c=$q(a,b,!1);c=a.Qm(c);null===a.Qb(c)&&gr(a,c,b);var d=a.Nf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],null===a.Qb(c)&&gr(a,c,b)}
t.Lq=function(a){if(null===a)return null;var b=this.ml;a=null!==b?b(a,this):Dr(this,a,!0);Fa(a)&&(fb(a),""!==this.mf&&fk(a,this.mf,void 0),""!==this.nf&&fk(a,this.nf,void 0),""!==this.Zd&&fk(a,this.Zd,[]));return a};t.fu=function(a){if(null===a)return!1;var b=this.am;return""===b?!1:Gn(a,b)?!0:!1};t.Wh=function(a){if(null!==a){var b=this.Ge;if(""!==b&&(b=Gn(a,b),void 0!==b)){if(br(b))return b;v("GroupKey value for node data "+a+" is not a number or a string: "+b)}}};
t.tr=function(a,b){null===b&&(b=void 0);void 0===b||br(b)||xa(b,"number or string",Hr,"setGroupKeyForNodeData:key");if(null!==a){var c=this.Ge;if(""!==c)if(this.$a(a)){var d=Gn(a,c);d!==b&&(fr(this,d,a),fk(a,c,b),null===this.Qb(b)&&gr(this,b,a),Br(this,"nodeGroupKey",He,c,a,d,b),"string"===typeof c&&this.Ha(a,c))}else fk(a,c,b)}};
Hr.prototype.copyNodeData=function(a){if(null===a)return null;a=W.prototype.copyNodeData.call(this,a);this.Ak||""===this.Ge||void 0===Gn(a,this.Ge)||fk(a,this.Ge,void 0);return a};
Hr.prototype.setDataProperty=function(a,b,c){F&&(A(a,"object",Hr,"setDataProperty:data"),A(b,"string",Hr,"setDataProperty:propname"),""===b&&v("GraphLinksModel.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.$a(a)){if(b===this.nodeKeyProperty){this.hn(a,c);return}if(b===this.nodeCategoryProperty){this.gn(a,c);return}if(b===this.nodeGroupKeyProperty){this.tr(a,c);return}F&&b===this.nodeIsGroupProperty&&v("GraphLinksModel.setDataProperty: property name must not be the nodeIsGroupProperty: "+
b)}else if(this.Cc(a)){if(b===this.linkFromKeyProperty){hr(this,a,c,!0);return}if(b===this.linkToKeyProperty){hr(this,a,c,!1);return}if(b===this.linkFromPortIdProperty){ir(this,a,c,!0);return}if(b===this.linkToPortIdProperty){ir(this,a,c,!1);return}if(b===this.linkKeyProperty){this.vu(a,c);return}if(b===this.linkCategoryProperty){this.sr(a,c);return}if(b===this.linkLabelKeysProperty){this.wu(a,c);return}}var d=Gn(a,b);d!==c&&(fk(a,b,c),this.qu(a,b,d,c))};t=Hr.prototype;
t.Gq=function(a,b){if(b){var c=this.$a(a),d=this.Cc(a),e;for(e in b)"__gohashid"===e||c&&e===this.nodeKeyProperty||c&&e===this.nodeIsGroupProperty&&Gn(a,e)===b[e]||d&&e===this.linkKeyProperty||this.setDataProperty(a,e,b[e])}};
t.qr=function(a,b){W.prototype.qr.call(this,a,b);for(var c=this.ab.iterator;c.next();)this.Iw(c.value,a,b);for(c=this.mg.iterator;c.next();){var d=c.value,e=a,f=b;if($q(this,d,!0)===e){var g=this.mf;fk(d,g,f);Br(this,"linkFromKey",He,g,d,e,f);"string"===typeof g&&this.Ha(d,g)}$q(this,d,!1)===e&&(g=this.nf,fk(d,g,f),Br(this,"linkToKey",He,g,d,e,f),"string"===typeof g&&this.Ha(d,g));g=this.Nf(d);if(Array.isArray(g))for(var h=g.length,k=this.Zd,l=0;l<h;l++)g[l]===e&&(g[l]=f,Br(this,"linkLabelKeys",Je,
k,d,e,f,l,l))}};t.Iw=function(a,b,c){if(this.Wh(a)===b){var d=this.Ge;fk(a,d,c);Br(this,"nodeGroupKey",He,d,a,b,c);"string"===typeof d&&this.Ha(a,d)}};t.gx=function(){W.prototype.gx.call(this);for(var a=this.linkDataArray,b=a.length,c=0;c<b;c++)Lr(this,a[c])};
t.cn=function(a){W.prototype.cn.call(this,a);a=this.pa(a);var b=er(this,a);if(null!==b){var c=La();for(b=b.iterator;b.next();){var d=b.value;if(this.$a(d)){if(this.Wh(d)===a){var e=this.Ge;Br(this,"nodeGroupKey",He,e,d,a,a);"string"===typeof e&&this.Ha(d,e);c.push(d)}}else if($q(this,d,!0)===a&&(e=this.mf,Br(this,"linkFromKey",He,e,d,a,a),"string"===typeof e&&this.Ha(d,e),c.push(d)),$q(this,d,!1)===a&&(e=this.nf,Br(this,"linkToKey",He,e,d,a,a),"string"===typeof e&&this.Ha(d,e),c.push(d)),e=this.Nf(d),
Array.isArray(e))for(var f=e.length,g=this.Zd,h=0;h<f;h++)e[h]===a&&(Br(this,"linkLabelKeys",Je,g,d,a,a,h,h),c.push(d))}for(b=0;b<c.length;b++)fr(this,a,c[b]);Oa(c)}};t.bn=function(a){W.prototype.bn.call(this,a);var b=this.Wh(a);null===this.Qb(b)&&gr(this,b,a)};t.yr=function(a){W.prototype.yr.call(this,a);var b=this.Wh(a);fr(this,b,a)};
t.Zt=function(a){if(null===a)return"";var b=this.bk;if(""===b)return"";b=Gn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;v("getCategoryForLinkData found a non-string category for "+a+": "+b);return""};Hr.prototype.getLinkCategoryForData=function(a){return this.Zt(a)};
Hr.prototype.sr=function(a,b){A(b,"string",Hr,"setCategoryForLinkData:cat");if(null!==a){var c=this.bk;if(""!==c)if(this.Cc(a)){var d=Gn(a,c);void 0===d&&(d="");d!==b&&(fk(a,c,b),Br(this,"linkCategory",He,c,a,d,b),"string"===typeof c&&this.Ha(a,c))}else fk(a,c,b)}};Hr.prototype.setLinkCategoryForData=function(a,b){this.sr(a,b)};t=Hr.prototype;t.jn=function(a,b){W.prototype.jn.call(this,a,b);this.tr(b,this.Wh(a))};
function Jr(a,b,c){a.sr(c,a.Zt(b));a.Ow(c,a.Jy(b));a.Tw(c,a.My(b));a.wu(c,a.Nf(b));a.Pw(c,a.Ky(b));a.Uw(c,a.Ny(b))}t.Jk=function(){return!0};t.Bj=function(){return!0};t.hu=function(){return!0};t.zj=function(){return!0};
ma.Object.defineProperties(Hr.prototype,{archetypeNodeData:{configurable:!0,get:function(){return this.Jj},set:function(a){var b=this.Jj;b!==a&&(null!==a&&A(a,"object",Hr,"archetypeNodeData"),this.Jj=a,this.g("archetypeNodeData",b,a))}},linkFromKeyProperty:{configurable:!0,get:function(){return this.mf},set:function(a){var b=this.mf;b!==a&&(Cr(a,Hr,"linkFromKeyProperty"),this.mf=a,this.g("linkFromKeyProperty",b,a))}},linkToKeyProperty:{configurable:!0,get:function(){return this.nf},
set:function(a){var b=this.nf;b!==a&&(Cr(a,Hr,"linkToKeyProperty"),this.nf=a,this.g("linkToKeyProperty",b,a))}},linkFromPortIdProperty:{configurable:!0,get:function(){return this.ck},set:function(a){var b=this.ck;b!==a&&(Cr(a,Hr,"linkFromPortIdProperty"),!F||a!==this.linkFromKeyProperty&&a!==this.linkToKeyProperty||v("linkFromPortIdProperty name must not be the same as the GraphLinksModel.linkFromKeyProperty or linkToKeyProperty: "+a),this.ck=a,this.g("linkFromPortIdProperty",b,a))}},
linkToPortIdProperty:{configurable:!0,get:function(){return this.dk},set:function(a){var b=this.dk;b!==a&&(Cr(a,Hr,"linkToPortIdProperty"),!F||a!==this.linkFromKeyProperty&&a!==this.linkToKeyProperty||v("linkFromPortIdProperty name must not be the same as the GraphLinksModel.linkFromKeyProperty or linkToKeyProperty: "+a),this.dk=a,this.g("linkToPortIdProperty",b,a))}},linkLabelKeysProperty:{configurable:!0,get:function(){return this.Zd},set:function(a){var b=this.Zd;b!==
a&&(Cr(a,Hr,"linkLabelKeysProperty"),this.Zd=a,this.g("linkLabelKeysProperty",b,a))}},linkDataArray:{configurable:!0,get:function(){return this.bd},set:function(a){var b=this.bd;if(b!==a){Ha(a,Hr,"linkDataArray");this.lb.clear();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!Fa(e)){v("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);return}ub(e)}this.bd=a;if(""!==this.linkKeyProperty){d=new H;for(e=0;e<c;e++){var f=a[e],g=this.ac(f);void 0===g?d.add(f):null!==this.lb.K(g)?
d.add(f):this.lb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.er(e),f=this.ac(e),void 0!==f&&this.lb.add(f,e)}d=new I;for(e=0;e<c;e++)d.add(a[e]);this.mg=d;Br(this,"linkDataArray",He,"linkDataArray",this,b,a);for(b=0;b<c;b++)Lr(this,a[b])}}},linkKeyProperty:{configurable:!0,get:function(){return this.Ri},set:function(a){var b=this.Ri;if(b!==a){Cr(a,Hr,"linkKeyProperty");this.Ri=a;this.lb.clear();for(var c=this.linkDataArray.length,d=0;d<c;d++){var e=this.linkDataArray[d],f=this.ac(e);
void 0===f&&(this.er(e),f=this.ac(e));void 0!==f&&this.lb.add(f,e)}this.g("linkKeyProperty",b,a)}}},makeUniqueLinkKeyFunction:{configurable:!0,get:function(){return this.Xl},set:function(a){var b=this.Xl;b!==a&&(null!==a&&A(a,"function",Hr,"makeUniqueLinkKeyFunction"),this.Xl=a,this.g("makeUniqueLinkKeyFunction",b,a))}},copyLinkDataFunction:{configurable:!0,get:function(){return this.ml},set:function(a){var b=this.ml;b!==a&&(null!==a&&A(a,"function",Hr,"copyLinkDataFunction"),
this.ml=a,this.g("copyLinkDataFunction",b,a))}},nodeIsGroupProperty:{configurable:!0,get:function(){return this.am},set:function(a){var b=this.am;b!==a&&(Cr(a,Hr,"nodeIsGroupProperty"),this.am=a,this.g("nodeIsGroupProperty",b,a))}},nodeGroupKeyProperty:{configurable:!0,get:function(){return this.Ge},set:function(a){var b=this.Ge;b!==a&&(Cr(a,Hr,"nodeGroupKeyProperty"),this.Ge=a,this.g("nodeGroupKeyProperty",b,a))}},Ak:{configurable:!0,get:function(){return this.Qn},
set:function(a){this.Qn!==a&&(A(a,"boolean",Hr,"copiesGroupKeyOfNodeData"),this.Qn=a)}},linkCategoryProperty:{configurable:!0,get:function(){return this.bk},set:function(a){var b=this.bk;b!==a&&(Cr(a,Hr,"linkCategoryProperty"),this.bk=a,this.g("linkCategoryProperty",b,a))}},type:{configurable:!0,get:function(){return"GraphLinksModel"}}});Hr.prototype.setCategoryForLinkData=Hr.prototype.sr;Hr.prototype.getCategoryForLinkData=Hr.prototype.Zt;
Hr.prototype.assignAllDataProperties=Hr.prototype.Gq;Hr.prototype.setGroupKeyForNodeData=Hr.prototype.tr;Hr.prototype.getGroupKeyForNodeData=Hr.prototype.Wh;Hr.prototype.isGroupForNodeData=Hr.prototype.fu;Hr.prototype.copyLinkData=Hr.prototype.Lq;Hr.prototype.mergeLinkDataArray=Hr.prototype.ZA;Hr.prototype.removeLinkDataCollection=Hr.prototype.hB;Hr.prototype.removeLinkData=Hr.prototype.Zm;Hr.prototype.addLinkDataCollection=Hr.prototype.Bz;Hr.prototype.addLinkData=Hr.prototype.mj;
Hr.prototype.containsLinkData=Hr.prototype.Cc;Hr.prototype.makeLinkDataKeyUnique=Hr.prototype.er;Hr.prototype.findLinkDataForKey=Hr.prototype.Pg;Hr.prototype.setKeyForLinkData=Hr.prototype.vu;Hr.prototype.getKeyForLinkData=Hr.prototype.ac;Hr.prototype.removeLabelKeyForLinkData=Hr.prototype.az;Hr.prototype.addLabelKeyForLinkData=Hr.prototype.Qv;Hr.prototype.setLabelKeysForLinkData=Hr.prototype.wu;Hr.prototype.getLabelKeysForLinkData=Hr.prototype.Nf;Hr.prototype.setToPortIdForLinkData=Hr.prototype.Uw;
Hr.prototype.getToPortIdForLinkData=Hr.prototype.Ny;Hr.prototype.setFromPortIdForLinkData=Hr.prototype.Pw;Hr.prototype.getFromPortIdForLinkData=Hr.prototype.Ky;Hr.prototype.setToKeyForLinkData=Hr.prototype.Tw;Hr.prototype.getToKeyForLinkData=Hr.prototype.My;Hr.prototype.setFromKeyForLinkData=Hr.prototype.Ow;Hr.prototype.getFromKeyForLinkData=Hr.prototype.Jy;Hr.prototype.clear=Hr.prototype.clear;var Kr=Object.freeze([]);Hr.className="GraphLinksModel";Fr.GraphLinksModel=Hr;
W.constructGraphLinksModel=W.constructGraphLinksModel=function(){return new Hr};W.initDiagramModel=Ki=function(){return new Hr};function Mr(a){F&&1<arguments.length&&v("TreeModel constructor can only take one optional argument, the Array of node data.");W.call(this);this.He="parent";this.Sn=!1;this.ik="parentLinkCategory";void 0!==a&&(this.nodeDataArray=a)}la(Mr,W);Mr.constructGraphLinksModel=W.constructGraphLinksModel;
Mr.prototype.cloneProtected=function(a){W.prototype.cloneProtected.call(this,a);a.He=this.He;a.Sn=this.Sn;a.ik=this.ik};t=Mr.prototype;t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.wr();var b=(""!==this.name?this.name:"")+" TreeModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+Qa(e)}}return b};
t.Zk=function(){var a=W.prototype.Zk.call(this),b="";"parent"!==this.nodeParentKeyProperty&&"string"===typeof this.nodeParentKeyProperty&&(b+=',\n  "nodeParentKeyProperty": '+this.quote(this.nodeParentKeyProperty));return a+b};t.lr=function(a){W.prototype.lr.call(this,a);a.nodeParentKeyProperty&&(this.nodeParentKeyProperty=a.nodeParentKeyProperty)};t.Br=function(a){ur(this,a,"nodeParentKeyProperty");return W.prototype.Br.call(this,a)};
t.kr=function(a){void 0!==a.nodeParentKeyProperty&&a.nodeParentKeyProperty!==this.nodeParentKeyProperty&&v("applyIncrementalJson cannot change Model properties");W.prototype.kr.call(this,a)};t.Qm=function(a){return a};t.Xh=function(a){if(null!==a){var b=this.He;if(""!==b&&(b=Gn(a,b),void 0!==b)){if(br(b))return b;v("ParentKey value for node data "+a+" is not a number or a string: "+b)}}};
t.je=function(a,b){null===b&&(b=void 0);void 0===b||br(b)||xa(b,"number or string",Mr,"setParentKeyForNodeData:key");if(null!==a){var c=this.He;if(""!==c)if(b=this.Qm(b),this.$a(a)){var d=Gn(a,c);d!==b&&(fr(this,d,a),fk(a,c,b),null===this.Qb(b)&&gr(this,b,a),Br(this,"nodeParentKey",He,c,a,d,b),"string"===typeof c&&this.Ha(a,c))}else fk(a,c,b)}};
t.au=function(a){if(null===a)return"";var b=this.ik;if(""===b)return"";b=Gn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;v("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};Mr.prototype.getLinkCategoryForData=function(a){return this.au(a)};
Mr.prototype.xu=function(a,b){A(b,"string",Mr,"setParentLinkCategoryForNodeData:cat");if(null!==a){var c=this.ik;if(""!==c)if(this.$a(a)){var d=Gn(a,c);void 0===d&&(d="");d!==b&&(fk(a,c,b),Br(this,"parentLinkCategory",He,c,a,d,b),"string"===typeof c&&this.Ha(a,c))}else fk(a,c,b)}};Mr.prototype.setLinkCategoryForData=function(a,b){this.xu(a,b)};
Mr.prototype.copyNodeData=function(a){if(null===a)return null;a=W.prototype.copyNodeData.call(this,a);this.Bk||""===this.He||void 0===Gn(a,this.He)||fk(a,this.He,void 0);return a};
Mr.prototype.setDataProperty=function(a,b,c){F&&(A(a,"object",Mr,"setDataProperty:data"),A(b,"string",Mr,"setDataProperty:propname"),""===b&&v("TreeModel.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.$a(a)){if(b===this.nodeKeyProperty){this.hn(a,c);return}if(b===this.nodeCategoryProperty){this.gn(a,c);return}if(b===this.nodeParentKeyProperty){this.je(a,c);return}}var d=Gn(a,b);d!==c&&(fk(a,b,c),this.qu(a,b,d,c))};t=Mr.prototype;
t.qr=function(a,b){W.prototype.qr.call(this,a,b);for(var c=this.ab.iterator;c.next();)this.Iw(c.value,a,b)};t.Iw=function(a,b,c){if(this.Xh(a)===b){var d=this.He;fk(a,d,c);Br(this,"nodeParentKey",He,d,a,b,c);"string"===typeof d&&this.Ha(a,d)}};
t.cn=function(a){W.prototype.cn.call(this,a);a=this.pa(a);var b=er(this,a);if(null!==b){var c=La();for(b=b.iterator;b.next();){var d=b.value;if(this.$a(d)&&this.Xh(d)===a){var e=this.He;Br(this,"nodeParentKey",He,e,d,a,a);"string"===typeof e&&this.Ha(d,e);c.push(d)}}for(b=0;b<c.length;b++)fr(this,a,c[b]);Oa(c)}};t.bn=function(a){W.prototype.bn.call(this,a);var b=this.Xh(a);b=this.Qm(b);null===this.Qb(b)&&gr(this,b,a)};t.yr=function(a){W.prototype.yr.call(this,a);var b=this.Xh(a);fr(this,b,a)};
t.jn=function(a,b){W.prototype.jn.call(this,a,b);this.xu(b,this.au(a));this.je(b,this.Xh(a))};t.Om=function(){return!0};t.hu=function(){return!0};
ma.Object.defineProperties(Mr.prototype,{nodeParentKeyProperty:{configurable:!0,get:function(){return this.He},set:function(a){var b=this.He;b!==a&&(Cr(a,Mr,"nodeParentKeyProperty"),this.He=a,this.g("nodeParentKeyProperty",b,a))}},Bk:{configurable:!0,get:function(){return this.Sn},set:function(a){this.Sn!==a&&(A(a,"boolean",Mr,"copiesParentKeyOfNodeData"),this.Sn=a)}},parentLinkCategoryProperty:{configurable:!0,get:function(){return this.ik},set:function(a){var b=
this.ik;b!==a&&(Cr(a,Mr,"parentLinkCategoryProperty"),this.ik=a,this.g("parentLinkCategoryProperty",b,a))}},linkCategoryProperty:{configurable:!0,get:function(){return this.parentLinkCategoryProperty},set:function(a){this.parentLinkCategoryProperty=a}},type:{configurable:!0,get:function(){return"TreeModel"}}});Mr.prototype.setParentLinkCategoryForNodeData=Mr.prototype.xu;Mr.prototype.getParentLinkCategoryForNodeData=Mr.prototype.au;
Mr.prototype.setParentKeyForNodeData=Mr.prototype.je;Mr.prototype.getParentKeyForNodeData=Mr.prototype.Xh;Mr.className="TreeModel";Fr.TreeModel=Mr;function Nr(){0<arguments.length&&za(Nr);Mi.call(this);this.Ix=this.ho=this.fc=0;this.ls=360;this.Hx=Or;this.Rj=0;this.zx=new J;this.Wr=this.de=0;this.Ht=new Pr;this.Nu=this.hk=0;this.sz=600;this.Jp=NaN;this.Bn=1;this.nq=0;this.tm=360;this.Kb=Or;this.M=Qr;this.dd=Rr;this.Zc=Dq;this.xf=6;this.sp=Sr}la(Nr,Mi);
Nr.prototype.cloneProtected=function(a){Mi.prototype.cloneProtected.call(this,a);a.Jp=this.Jp;a.Bn=this.Bn;a.nq=this.nq;a.tm=this.tm;a.Kb=this.Kb;a.M=this.M;a.dd=this.dd;a.Zc=this.Zc;a.xf=this.xf;a.sp=this.sp};
Nr.prototype.nb=function(a){if(a.classType===Nr)if(a===Tr||a===Ur||a===Vr||a===Wr||a===Rr)this.sorting=a;else if(a===Xr||a===Yr||a===Qr||a===Zr)this.direction=a;else if(a===$r||a===as||a===Or||a===bs)this.arrangement=a;else{if(a===cs||a===Sr)this.nodeDiameterFormula=a}else Mi.prototype.nb.call(this,a)};Nr.prototype.createNetwork=function(){return new ds(this)};
Nr.prototype.doLayout=function(a){F&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);a=this.network.vertexes;if(1>=a.count)1===a.count&&(a=a.first(),a.centerX=0,a.centerY=0);else{var b=new H;b.addAll(a.iterator);a=new H;var c=new H;var d=this.sort(b);var e,f,g=this.Wr;var h=this.arrangement;var k=this.nodeDiameterFormula;
var l=this.radius;if(!isFinite(l)||0>=l)l=NaN;var m=this.aspectRatio;if(!isFinite(m)||0>=m)m=1;var n=this.startAngle;isFinite(n)||(n=0);var p=this.sweepAngle;if(!isFinite(p)||360<p||1>p)p=360;b=this.spacing;isFinite(b)||(b=NaN);h===bs&&k===cs?h=Or:h===bs&&k!==cs&&(h=this.arrangement);if((this.direction===Xr||this.direction===Yr)&&this.sorting!==Rr){for(k=0;!(k>=d.length);k+=2){a.add(d.O(k));if(k+1>=d.length)break;c.add(d.O(k+1))}this.direction===Xr?(this.arrangement===bs&&a.reverse(),d=new H,d.addAll(a),
d.addAll(c)):(this.arrangement===bs&&c.reverse(),d=new H,d.addAll(c),d.addAll(a))}k=d.length;for(var r=f=e=0;r<d.length;r++){var q=n+p*f*(this.direction===Qr?1:-1)/k,u=d.O(r).diameter;isNaN(u)&&(u=es(d.O(r),q));360>p&&(0===r||r===d.length-1)&&(u/=2);e+=u;f++}if(isNaN(l)||h===bs){isNaN(b)&&(b=6);if(h!==Or&&h!==bs){f=-Infinity;for(g=0;g<k;g++)r=d.O(g),e=d.O(g===k-1?0:g+1),isNaN(r.diameter)&&es(r,0),isNaN(e.diameter)&&es(e,0),f=Math.max(f,(r.diameter+e.diameter)/2);g=f+b;h===$r?l=(f+b)/(2*Math.PI/k):
l=fs(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180)}else l=fs(this,e+(360<=p?k:k-1)*(h!==bs?b:1.6*b),m,n*Math.PI/180,p*Math.PI/180);f=l*m}else if(f=l*m,r=gs(this,l,f,n*Math.PI/180,p*Math.PI/180),isNaN(b)){if(h===Or||h===bs)b=(r-e)/(360<=p?k:k-1)}else if(h===Or||h===bs)r=(r-e)/(360<=p?k:k-1),r<b?(l=fs(this,e+b*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180),f=l*m):b=r;else{g=-Infinity;for(e=0;e<k;e++)q=d.O(e),u=d.O(e===k-1?0:e+1),isNaN(q.diameter)&&es(q,0),isNaN(u.diameter)&&es(u,0),g=Math.max(g,
(q.diameter+u.diameter)/2);g+=b;e=fs(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180);e>l?(l=e,f=l*m):g=r/(360<=p?k:k-1)}this.Hx=h;this.fc=l;this.ho=m;this.Ix=n;this.ls=p;this.Rj=b;this.de=f;this.Wr=g;b=d;d=this.Hx;h=this.fc;l=this.Ix;m=this.ls;n=this.Rj;p=this.de;k=this.Wr;if(this.direction!==Xr&&this.direction!==Yr||d!==bs)if(this.direction===Xr||this.direction===Yr){g=0;switch(d){case as:g=180*hs(this,h,p,l,k)/Math.PI;break;case Or:k=b=0;g=a.first();null!==g&&(b=es(g,Math.PI/2));g=c.first();
null!==g&&(k=es(g,Math.PI/2));g=180*hs(this,h,p,l,n+(b+k)/2)/Math.PI;break;case $r:g=m/b.length}if(this.direction===Xr){switch(d){case as:is(this,a,l,Zr);break;case Or:js(this,a,l,Zr);break;case $r:ks(this,a,m/2,l,Zr)}switch(d){case as:is(this,c,l+g,Qr);break;case Or:js(this,c,l+g,Qr);break;case $r:ks(this,c,m/2,l+g,Qr)}}else{switch(d){case as:is(this,c,l,Zr);break;case Or:js(this,c,l,Zr);break;case $r:ks(this,c,m/2,l,Zr)}switch(d){case as:is(this,a,l+g,Qr);break;case Or:js(this,a,l+g,Qr);break;case $r:ks(this,
a,m/2,l+g,Qr)}}}else switch(d){case as:is(this,b,l,this.direction);break;case Or:js(this,b,l,this.direction);break;case $r:ks(this,b,m,l,this.direction);break;case bs:ls(this,b,m,l,this.direction)}else ls(this,b,m,l-m/2,Qr)}this.updateParts();this.network=null;this.isValidLayout=!0};
function ks(a,b,c,d,e){var f=a.ls,g=a.fc;a=a.de;d=d*Math.PI/180;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=d+(e===Qr?k*c/(360<=f?h:h-1):-(k*c)/h),m=b.O(k),n=g*Math.tan(l)/a;n=Math.sqrt((g*g+a*a*n*n)/(1+n*n));m.centerX=n*Math.cos(l);m.centerY=n*Math.sin(l);m.actualAngle=180*l/Math.PI}}
function js(a,b,c,d){var e=a.fc,f=a.de,g=a.Rj;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.O(k),m=b.O(k===h-1?0:k+1),n=f*Math.sin(c);l.centerX=e*Math.cos(c);l.centerY=n;l.actualAngle=180*c/Math.PI;isNaN(l.diameter)&&es(l,0);isNaN(m.diameter)&&es(m,0);l=hs(a,e,f,d===Qr?c:-c,(l.diameter+m.diameter)/2+g);c+=d===Qr?l:-l}}
function is(a,b,c,d){var e=a.fc,f=a.de,g=a.Wr;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.O(k);l.centerX=e*Math.cos(c);l.centerY=f*Math.sin(c);l.actualAngle=180*c/Math.PI;l=hs(a,e,f,d===Qr?c:-c,g);c+=d===Qr?l:-l}}function ls(a,b,c,d,e){var f=a.ls;a.hk=0;a.Ht=new Pr;if(360>c){for(f=d+(e===Qr?f:-f);0>f;)f+=360;f%=360;180<f&&(f-=360);f*=Math.PI/180;a.Nu=f;ms(a,b,c,d,e)}else ns(a,b,c,d,e);a.Ht.commit(b)}
function ns(a,b,c,d,e){var f=a.fc,g=a.Rj,h=a.ho,k=f*Math.cos(d*Math.PI/180),l=a.de*Math.sin(d*Math.PI/180),m=b.ta();if(3===m.length)m[0].centerX=f,m[0].centerY=0,m[1].centerX=m[0].centerX-m[0].width/2-m[1].width/2-g,m[1].y=m[0].y,m[2].centerX=(m[0].centerX+m[1].centerX)/2,m[2].y=m[0].y-m[2].height-g;else if(4===m.length)m[0].centerX=f,m[0].centerY=0,m[2].centerX=-m[0].centerX,m[2].centerY=m[0].centerY,m[1].centerX=0,m[1].y=Math.min(m[0].y,m[2].y)-m[1].height-g,m[3].centerX=0,m[3].y=Math.max(m[0].y+
m[0].height+g,m[2].y+m[2].height+g);else{f=J.alloc();for(var n=0;n<m.length;n++){m[n].centerX=k;m[n].centerY=l;if(n>=m.length-1)break;os(a,k,l,m,n,e,f)||ps(a,k,l,m,n,e,f);k=f.x;l=f.y}J.free(f);a.hk++;if(!(23<a.hk)){k=m[0].centerX;l=m[0].centerY;f=m[m.length-1].centerX;n=m[m.length-1].centerY;var p=Math.abs(k-f)-((m[0].width+m[m.length-1].width)/2+g),r=Math.abs(l-n)-((m[0].height+m[m.length-1].height)/2+g);g=0;1>Math.abs(r)?Math.abs(k-f)<(m[0].width+m[m.length-1].width)/2&&(g=0):g=0<r?r:1>Math.abs(p)?
0:p;k=Math.abs(f)>Math.abs(n)?0<f!==l>n:0<n!==k<f;if(k=e===Qr?k:!k)g=-Math.abs(g),g=Math.min(g,-m[m.length-1].width),g=Math.min(g,-m[m.length-1].height);a.Ht.compare(g,m);1<Math.abs(g)&&(a.fc=8>a.hk?a.fc-g/(2*Math.PI):5>m.length&&10<g?a.fc/2:a.fc-(0<g?1.7:-2.3),a.de=a.fc*h,ns(a,b,c,d,e))}}}
function ms(a,b,c,d,e){for(var f=a.fc,g=a.de,h=a.ho,k=f*Math.cos(d*Math.PI/180),l=g*Math.sin(d*Math.PI/180),m=J.alloc(),n=b.ta(),p=0;p<n.length;p++){n[p].centerX=k;n[p].centerY=l;if(p>=n.length-1)break;os(a,k,l,n,p,e,m)||ps(a,k,l,n,p,e,m);k=m.x;l=m.y}J.free(m);a.hk++;if(!(23<a.hk)){k=Math.atan2(l,k);k=e===Qr?a.Nu-k:k-a.Nu;k=Math.abs(k)<Math.abs(k-2*Math.PI)?k:k-2*Math.PI;f=k*(f+g)/2;g=a.Ht;if(Math.abs(f)<Math.abs(g.Jm))for(g.Jm=f,g.$k=[],g.on=[],k=0;k<n.length;k++)g.$k[k]=n[k].bounds.x,g.on[k]=n[k].bounds.y;
1<Math.abs(f)&&(a.fc=8>a.hk?a.fc-f/(2*Math.PI):a.fc-(0<f?1.7:-2.3),a.de=a.fc*h,ms(a,b,c,d,e))}}function os(a,b,c,d,e,f,g){var h=a.fc,k=a.de,l=0;a=(d[e].width+d[e+1].width)/2+a.Rj;var m=!1;if(0<=c!==(f===Qr)){if(f=b+a,f>h){f=b-a;if(f<-h)return g.x=f,g.y=l,!1;m=!0}}else if(f=b-a,f<-h){f=b+a;if(f>h)return g.x=f,g.y=l,!1;m=!0}l=Math.sqrt(1-Math.min(1,f*f/(h*h)))*k;0>c!==m&&(l=-l);if(Math.abs(c-l)>(d[e].height+d[e+1].height)/2)return g.x=f,g.y=l,!1;g.x=f;g.y=l;return!0}
function ps(a,b,c,d,e,f,g){var h=a.fc,k=a.de,l=0;a=(d[e].height+d[e+1].height)/2+a.Rj;d=!1;if(0<=b!==(f===Qr)){if(f=c-a,f<-k){f=c+a;if(f>k){g.x=l;g.y=f;return}d=!0}}else if(f=c+a,f>k){f=c-a;if(f<-k){g.x=l;g.y=f;return}d=!0}l=Math.sqrt(1-Math.min(1,f*f/(k*k)))*h;0>b!==d&&(l=-l);g.x=l;g.y=f}Nr.prototype.commitLayout=function(){this.commitNodes();this.isRouting&&this.commitLinks()};
Nr.prototype.commitNodes=function(){var a=null!==this.group&&null!==this.group.placeholder&&this.group.isSubGraphExpanded,b=a?this.group.location.copy():null,c=this.actualCenter;a?c=new J(0,0):(c.x=this.arrangementOrigin.x+this.fc,c.y=this.arrangementOrigin.y+this.de);for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;e.x+=c.x;e.y+=c.y;e.commit()}a&&(this.group.Ya(),a=this.group.position.copy(),c=this.group.location.copy(),b=b.ke(c.ke(a)),this.group.move(b),this.zx=b.ke(a))};
Nr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};function gs(a,b,c,d,e){var f=a.sz;if(.001>Math.abs(a.ho-1))return void 0!==d&&void 0!==e?e*b:2*Math.PI*b;a=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c;var g=0;var h=void 0!==d&&void 0!==e?e/(f+1):Math.PI/(2*(f+1));for(var k=0,l=0;l<=f;l++){void 0!==d&&void 0!==e?k=d+l*e/f:k=l*Math.PI/(2*f);var m=Math.sin(k);g+=Math.sqrt(1-a*a*m*m)*h}return void 0!==d&&void 0!==e?(b>c?b:c)*g:4*(b>c?b:c)*g}
function fs(a,b,c,d,e){return b/(void 0!==d&&void 0!==e?gs(a,1,c,d,e):gs(a,1,c))}function hs(a,b,c,d,e){if(.001>Math.abs(a.ho-1))return e/b;var f=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c,g=0;a=2*Math.PI/(700*a.network.vertexes.count);b>c&&(d+=Math.PI/2);for(var h=0;;h++){var k=Math.sin(d+h*a);g+=(b>c?b:c)*Math.sqrt(1-f*f*k*k)*a;if(g>=e)return h*a}}
Nr.prototype.sort=function(a){switch(this.sorting){case Vr:break;case Wr:a.reverse();break;case Tr:a.sort(this.comparer);break;case Ur:a.sort(this.comparer);a.reverse();break;case Rr:for(var b=[],c=0;c<a.length;c++)b.push(0);c=new H;for(var d=0;d<a.length;d++){var e=-1,f=-1;if(0===d)for(var g=0;g<a.length;g++){var h=a.O(g).edgesCount;h>e&&(e=h,f=g)}else for(g=0;g<a.length;g++)h=b[g],h>e&&(e=h,f=g);c.add(a.O(f));b[f]=-1;f=a.O(f);for(g=f.sourceEdges;g.next();)e=a.indexOf(g.value.fromVertex),0>e||0<=
b[e]&&b[e]++;for(f=f.destinationEdges;f.next();)e=a.indexOf(f.value.toVertex),0>e||0<=b[e]&&b[e]++}a=[];for(b=0;b<c.length;b++){e=c.O(b);a[b]=[];for(f=e.destinationEdges;f.next();)d=c.indexOf(f.value.toVertex),d!==b&&0>a[b].indexOf(d)&&a[b].push(d);for(e=e.sourceEdges;e.next();)d=c.indexOf(e.value.fromVertex),d!==b&&0>a[b].indexOf(d)&&a[b].push(d)}f=[];for(b=0;b<a.length;b++)f[b]=0;b=[];g=[];h=[];e=[];d=new H;for(var k=0,l=0;l<a.length;l++){var m=a[l].length;if(1===m)e.push(l);else if(0===m)d.add(c.O(l));
else{if(0===k)b.push(l);else{for(var n=m=Infinity,p=-1,r=[],q=0;q<b.length;q++)0>a[b[q]].indexOf(b[q===b.length-1?0:q+1])&&r.push(q===b.length-1?0:q+1);if(0===r.length)for(q=0;q<b.length;q++)r.push(q);for(q=0;q<r.length;q++){for(var u=r[q],w=a[l],y=0,z=0;z<g.length;z++){var B=f[g[z]],D=f[h[z]];if(B<D){var G=B;B=D}else G=D;if(G<u&&u<=B)for(D=0;D<w.length;D++){var O=w[D];0>b.indexOf(O)||G<f[O]&&f[O]<B||G===f[O]||B===f[O]||y++}else for(D=0;D<w.length;D++)O=w[D],0>b.indexOf(O)||G<f[O]&&f[O]<B&&G!==f[O]&&
B!==f[O]&&y++}w=y;for(z=y=0;z<a[l].length;z++)G=b.indexOf(a[l][z]),0<=G&&(G=Math.abs(u-(G>=u?G+1:G)),y+=G<b.length+1-G?G:b.length+1-G);for(z=0;z<g.length;z++)G=f[g[z]],B=f[h[z]],G>=u&&G++,B>=u&&B++,G>B&&(D=B,B=G,G=D),B-G<(b.length+2)/2===(G<u&&u<=B)&&y++;if(w<m||w===m&&y<n)m=w,n=y,p=u}b.splice(p,0,l);for(m=0;m<b.length;m++)f[b[m]]=m;for(m=0;m<a[l].length;m++)n=a[l][m],0<=b.indexOf(n)&&(g.push(l),h.push(n))}k++}}for(g=b.length;;){f=!0;for(h=0;h<e.length;h++)if(k=e[h],l=a[k][0],m=b.indexOf(l),0<=m){for(p=
n=0;p<a[l].length;p++)r=b.indexOf(a[l][p]),0>r||r===m||(q=r>m?r-m:m-r,n+=r<m!==q>g-q?1:-1);b.splice(0>n?m:m+1,0,k);e.splice(h,1);h--}else f=!1;if(f)break;else b.push(e[0]),e.splice(0,1)}for(a=0;a<b.length;a++)d.add(c.O(b[a]));return d;default:v("Invalid sorting type.")}return a};
ma.Object.defineProperties(Nr.prototype,{radius:{configurable:!0,get:function(){return this.Jp},set:function(a){this.Jp!==a&&(A(a,"number",Nr,"radius"),0<a||isNaN(a))&&(this.Jp=a,this.D())}},aspectRatio:{configurable:!0,get:function(){return this.Bn},set:function(a){this.Bn!==a&&(A(a,"number",Nr,"aspectRatio"),0<a&&(this.Bn=a,this.D()))}},startAngle:{configurable:!0,get:function(){return this.nq},set:function(a){this.nq!==a&&(A(a,"number",Nr,"startAngle"),
this.nq=a,this.D())}},sweepAngle:{configurable:!0,get:function(){return this.tm},set:function(a){this.tm!==a&&(A(a,"number",Nr,"sweepAngle"),0<a&&360>=a?this.tm=a:this.tm=360,this.D())}},arrangement:{configurable:!0,get:function(){return this.Kb},set:function(a){this.Kb!==a&&(hb(a,Nr,Nr,"arrangement"),a===bs||a===Or||a===as||a===$r)&&(this.Kb=a,this.D())}},direction:{configurable:!0,get:function(){return this.M},set:function(a){this.M!==a&&(hb(a,Nr,Nr,"direction"),
a===Qr||a===Zr||a===Xr||a===Yr)&&(this.M=a,this.D())}},sorting:{configurable:!0,get:function(){return this.dd},set:function(a){this.dd!==a&&(hb(a,Nr,Nr,"sorting"),a===Vr||a===Wr||a===Tr||Ur||a===Rr)&&(this.dd=a,this.D())}},comparer:{configurable:!0,get:function(){return this.Zc},set:function(a){this.Zc!==a&&(A(a,"function",Nr,"comparer"),this.Zc=a,this.D())}},spacing:{configurable:!0,get:function(){return this.xf},set:function(a){this.xf!==a&&(A(a,"number",
Nr,"spacing"),this.xf=a,this.D())}},nodeDiameterFormula:{configurable:!0,get:function(){return this.sp},set:function(a){this.sp!==a&&(hb(a,Nr,Nr,"nodeDiameterFormula"),a===Sr||a===cs)&&(this.sp=a,this.D())}},actualXRadius:{configurable:!0,get:function(){return this.fc}},actualYRadius:{configurable:!0,get:function(){return this.de}},actualSpacing:{configurable:!0,get:function(){return this.Rj}},actualCenter:{configurable:!0,get:function(){return this.zx}}});
var Or=new E(Nr,"ConstantSpacing",0),as=new E(Nr,"ConstantDistance",1),$r=new E(Nr,"ConstantAngle",2),bs=new E(Nr,"Packed",3),Qr=new E(Nr,"Clockwise",4),Zr=new E(Nr,"Counterclockwise",5),Xr=new E(Nr,"BidirectionalLeft",6),Yr=new E(Nr,"BidirectionalRight",7),Vr=new E(Nr,"Forwards",8),Wr=new E(Nr,"Reverse",9),Tr=new E(Nr,"Ascending",10),Ur=new E(Nr,"Descending",11),Rr=new E(Nr,"Optimized",12),Sr=new E(Nr,"Pythagorean",13),cs=new E(Nr,"Circular",14);Nr.className="CircularLayout";Nr.ConstantSpacing=Or;
Nr.ConstantDistance=as;Nr.ConstantAngle=$r;Nr.Packed=bs;Nr.Clockwise=Qr;Nr.Counterclockwise=Zr;Nr.BidirectionalLeft=Xr;Nr.BidirectionalRight=Yr;Nr.Forwards=Vr;Nr.Reverse=Wr;Nr.Ascending=Tr;Nr.Descending=Ur;Nr.Optimized=Rr;Nr.Pythagorean=Sr;Nr.Circular=cs;function Pr(){this.Jm=-Infinity;this.on=this.$k=null}
Pr.prototype.compare=function(a,b){if(0<a&&0>this.Jm||Math.abs(a)<Math.abs(this.Jm)&&!(0>a&&0<this.Jm))for(this.Jm=a,this.$k=[],this.on=[],a=0;a<b.length;a++)this.$k[a]=b[a].bounds.x,this.on[a]=b[a].bounds.y};Pr.prototype.commit=function(a){if(null!==this.$k&&null!==this.on)for(var b=0;b<this.$k.length;b++){var c=a.O(b);c.x=this.$k[b];c.y=this.on[b]}};Pr.className="VertexArrangement";function ds(a){iq.call(this,a)}la(ds,iq);ds.prototype.createVertex=function(){return new qs(this)};
ds.prototype.createEdge=function(){return new rs(this)};ds.className="CircularNetwork";function qs(a){wq.call(this,a);this.L=this.Pj=NaN}la(qs,wq);
function es(a,b){var c=a.network;if(null===c)return NaN;c=c.layout;if(null===c)return NaN;if(c.arrangement===bs)if(c.nodeDiameterFormula===cs)a.Pj=Math.max(a.width,a.height);else{c=Math.abs(Math.sin(b));b=Math.abs(Math.cos(b));if(0===c)return a.width;if(0===b)return a.height;a.Pj=Math.min(a.height/c,a.width/b)}else a.Pj=c.nodeDiameterFormula===cs?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.Pj}
ma.Object.defineProperties(qs.prototype,{diameter:{configurable:!0,get:function(){return this.Pj},set:function(a){this.Pj!==a&&(A(a,"number",qs,"diameter"),this.Pj=a)}},actualAngle:{configurable:!0,get:function(){return this.L},set:function(a){this.L!==a&&(A(a,"number",qs,"actualAngle"),this.L=a)}}});qs.className="CircularVertex";function rs(a){xq.call(this,a)}la(rs,xq);rs.className="CircularEdge";
function ss(){0<arguments.length&&za(ss);Mi.call(this);this.Qh=null;this.No=0;this.Od=(new Hb(100,100)).freeze();this.An=!1;this.vf=!0;this.ld=!1;this.Yl=100;this.ko=1;this.ig=1E3;this.lp=10;this.Kp=Math;this.tl=.05;this.sl=50;this.ql=150;this.rl=0;this.$n=10;this.Zn=5}la(ss,Mi);
ss.prototype.cloneProtected=function(a){Mi.prototype.cloneProtected.call(this,a);a.Od.assign(this.Od);a.An=this.An;a.vf=this.vf;a.ld=this.ld;a.Yl=this.Yl;a.ko=this.ko;a.ig=this.ig;a.lp=this.lp;a.Kp=this.Kp;a.tl=this.tl;a.sl=this.sl;a.ql=this.ql;a.rl=this.rl;a.$n=this.$n;a.Zn=this.Zn};
ss.prototype.serializeLayoutProperties=function(a,b){Mi.prototype.serializeLayoutProperties.call(this,a,b);a.arrangementSpacing={width:this.arrangementSpacing.width,height:this.arrangementSpacing.height};a.arrangesToOrigin=this.arrangesToOrigin;a.setsPortSpots=this.setsPortSpots;a.comments=this.comments;a.maxIterations=this.maxIterations;a.epsilonDistance=this.epsilonDistance;a.infinityDistance=this.infinityDistance;a.moveLimit=this.moveLimit;a.defaultSpringStiffness=this.defaultSpringStiffness;a.defaultSpringLength=
this.defaultSpringLength;a.defaultElectricalCharge=this.defaultElectricalCharge;a.defaultGravitationalMass=this.defaultGravitationalMass;a.defaultCommentSpringLength=this.defaultCommentSpringLength;a.defaultCommentElectricalCharge=this.defaultCommentElectricalCharge};
ss.prototype.deserializeLayoutProperties=function(a,b,c,d){Mi.prototype.deserializeLayoutProperties.call(this,a,b,c,d);this.arrangementSpacing=new Hb(a.arrangementSpacing.width,a.arrangementSpacing.height);this.arrangesToOrigin=a.arrangesToOrigin;this.setsPortSpots=a.setsPortSpots;this.comments=a.comments;this.maxIterations=a.maxIterations;this.epsilonDistance=a.epsilonDistance;this.infinityDistance=a.infinityDistance;this.moveLimit=a.moveLimit;this.defaultSpringStiffness=a.defaultSpringStiffness;
this.defaultSpringLength=a.defaultSpringLength;this.defaultElectricalCharge=a.defaultElectricalCharge;this.defaultGravitationalMass=a.defaultGravitationalMass;this.defaultCommentSpringLength=a.defaultCommentSpringLength;this.defaultCommentElectricalCharge=a.defaultCommentElectricalCharge};ss.prototype.createNetwork=function(){return new ts(this)};
ss.prototype.doLayout=function(a){F&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));if(!this.ix()){a=this.maxIterations;if(0<this.network.vertexes.count){this.network.Mq();for(var b=this.network.vertexes.iterator;b.next();){var c=b.value;c.charge=this.electricalCharge(c);c.mass=this.gravitationalMass(c)}for(b=this.network.edges.iterator;b.next();)c=b.value,c.stiffness=this.springStiffness(c),
c.length=this.springLength(c);this.Sv();this.No=0;if(this.needsClusterLayout()){b=this.network;c=b.jz();for(var d=c.iterator;d.next();){this.network=d.value;for(var e=this.network.vertexes.iterator;e.next();){var f=e.value;f.Kd=f.vertexes.count;f.ci=1;f.zk=null;f.Xe=null}us(this,0,a)}this.network=b;var g=d=c.iterator;F&&x(b,ts,ss,"arrangeConnectedGraphs:singletons");d=this.arrangementSpacing;var h=g.count,k=!0;f=e=0;for(var l=La(),m=0;m<h+b.vertexes.count+2;m++)l[m]=null;h=0;g.reset();for(var n=L.alloc();g.next();)if(m=
g.value,this.computeBounds(m,n),k)k=!1,e=n.x+n.width/2,f=n.y+n.height/2,l[0]=new J(n.x+n.width+d.width,n.y),l[1]=new J(n.x,n.y+n.height+d.height),h=2;else{var p=vs(l,h,e,f,n.width,n.height,d),r=l[p],q=new J(r.x+n.width+d.width,r.y),u=new J(r.x,r.y+n.height+d.height);p+1<h&&l.splice(p+1,0,null);l[p]=q;l[p+1]=u;h++;p=r.x-n.x;r=r.y-n.y;for(m=m.vertexes.iterator;m.next();)q=m.value,q.centerX+=p,q.centerY+=r}L.free(n);for(m=b.vertexes.iterator;m.next();)g=m.value,p=g.bounds,2>h?(e=p.x+p.width/2,f=p.y+
p.height/2,l[0]=new J(p.x+p.width+d.width,p.y),l[1]=new J(p.x,p.y+p.height+d.height),h=2):(k=vs(l,h,e,f,p.width,p.height,d),n=l[k],r=new J(n.x+p.width+d.width,n.y),p=new J(n.x,n.y+p.height+d.height),k+1<h&&l.splice(k+1,0,null),l[k]=r,l[k+1]=p,h++,g.centerX=n.x+g.width/2,g.centerY=n.y+g.height/2);Oa(l);for(d=c.iterator;d.next();){c=d.value;for(e=c.vertexes.iterator;e.next();)b.Ng(e.value);for(c=c.edges.iterator;c.next();)b.Am(c.value)}}ws(this,a);this.updateParts()}this.Yl=a;this.network=null;this.isValidLayout=
!0}};ss.prototype.needsClusterLayout=function(){if(3>this.network.vertexes.count)return!1;for(var a=0,b=0,c=this.network.vertexes.first().bounds,d=this.network.vertexes.iterator;d.next();){if(d.value.bounds.Rc(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};ss.prototype.computeBounds=function(a,b){var c=!0;for(a=a.vertexes.iterator;a.next();){var d=a.value;c?(c=!1,b.set(d.bounds)):b.Uc(d.bounds)}return b};
function xs(a,b,c){F&&(C(b,ss,"computeClusterLayoutIterations:level"),C(c,ss,"computeClusterLayoutIterations:maxiter"));return Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10)}
function us(a,b,c){F&&(C(b,ss,"layoutClusters:level"),C(c,ss,"layoutClusters:maxiter"));if(ys(a,b)){var d=a.ig;a.ig*=1+1/(b+1);var e=zs(a,b),f=Math.max(0,xs(a,b,c));a.maxIterations+=f;us(a,b+1,c);ws(a,f);As(a,e,b);c=e.vertexes.ta();c.sort(function(a,b){return null===a||null===b||a===b?0:b.Kd-a.Kd});for(e=0;e<c.length;e++)Bs(a,c[e],b);a.ig=d}}
function ys(a,b){F&&C(b,ss,"hasClusters:level");if(10<b||3>a.network.vertexes.count)return!1;a.Qh=a.network.vertexes.ta();a=a.Qh;a.sort(function(a,b){return null===a||null===b||a===b?0:b.Kd-a.Kd});for(b=a.length-1;0<=b&&1>=a[b].Kd;)b--;return 1<a.length-b}
function zs(a,b){F&&C(b,ss,"pushSubNetwork:level");for(var c=a.network,d=new ts(a),e=0;e<a.Qh.length;e++){var f=a.Qh[e];if(1<f.Kd){d.Ng(f);var g=new Cs;g.Cu=f.Kd;g.Du=f.width;g.Bu=f.height;g.ox=f.focus.x;g.px=f.focus.y;null===f.Xe&&(f.Xe=new H);f.Xe.add(g);f.Mw=f.Xe.count-1}else break}for(f=c.edges.iterator;f.next();){var h=f.value;e=h.fromVertex;g=h.toVertex;e.network===d&&g.network===d?d.Am(h):e.network===d?(h=e.zk,null===h&&(h=new H,e.zk=h),h.add(g),e.Kd--,e.ci+=g.ci):g.network===d&&(h=g.zk,null===
h&&(h=new H,g.zk=h),h.add(e),g.Kd--,g.ci+=e.ci)}for(e=d.edges.iterator;e.next();)f=e.value,f.length*=Math.max(1,K.sqrt((f.fromVertex.ci+f.toVertex.ci)/(4*b+1)));for(b=d.vertexes.iterator;b.next();){e=b.value;var k=e.zk;if(null!==k&&0<k.count&&(g=e.Xe.O(e.Xe.count-1).Cu-e.Kd,!(0>=g))){for(var l=h=0,m=k.count-g;m<k.count;m++){var n=k.O(m),p=null;for(f=n.edges.iterator;f.next();){var r=f.value;if(r.Ly(n)===e){p=r;break}}null!==p&&(l+=p.length,h+=n.width*n.height)}f=e.centerX;k=e.centerY;m=e.width;n=
e.height;p=e.focus;r=m*n;1>r&&(r=1);h=K.sqrt((h+r+l*l*4/(g*g))/r);g=(h-1)*m/2;h=(h-1)*n/2;e.bounds=new L(f-p.x-g,k-p.y-h,m+2*g,n+2*h);e.focus=new J(p.x+g,p.y+h)}}a.network=d;return c}
function As(a,b,c){F&&(x(b,ts,ss,"popNetwork:oldnet"),C(c,ss,"popNetwork:level"));for(c=a.network.vertexes.iterator;c.next();){var d=c.value;d.network=b;if(null!==d.Xe){var e=d.Xe.O(d.Mw);d.Kd=e.Cu;var f=e.ox,g=e.px;d.bounds=new L(d.centerX-f,d.centerY-g,e.Du,e.Bu);d.focus=new J(f,g);d.Mw--}}for(c=a.network.edges.iterator;c.next();)c.value.network=b;a.network=b}
function Bs(a,b,c){F&&(x(b,Ds,ss,"surroundNode:oldnet"),C(c,ss,"surroundNode:level"));var d=b.zk;if(null!==d&&0!==d.count){c=b.centerX;var e=b.centerY,f=b.width,g=b.height;null!==b.Xe&&0<b.Xe.count&&(g=b.Xe.O(0),f=g.Du,g=g.Bu);f=K.sqrt(f*f+g*g)/2;for(var h=!1,k=g=0,l=0,m=b.vertexes.iterator;m.next();){var n=m.value;1>=n.Kd?k++:(h=!0,l++,g+=Math.atan2(b.centerY-n.centerY,b.centerX-n.centerX))}if(0!==k)for(0<l&&(g/=l),l=b=0,b=h?2*Math.PI/(k+1):2*Math.PI/k,0===k%2&&(l=b/2),1<d.count&&d.sort(function(a,
b){return null===a||null===b||a===b?0:b.width*b.height-a.width*a.height}),h=0===k%2?0:1,d=d.iterator;d.next();)if(k=d.value,!(1<k.Kd||a.isFixed(k))){m=null;for(n=k.edges.iterator;n.next();){m=n.value;break}n=k.width;var p=k.height;n=K.sqrt(n*n+p*p)/2;m=f+m.length+n;n=g+(b*(h/2>>1)+l)*(0===h%2?1:-1);k.centerX=c+m*Math.cos(n);k.centerY=e+m*Math.sin(n);h++}}}
function vs(a,b,c,d,e,f,g){var h=9E19,k=-1,l=0;a:for(;l<b;l++){var m=a[l],n=m.x-c,p=m.y-d;n=n*n+p*p;if(n<h){for(p=l-1;0<=p;p--)if(a[p].y>m.y&&a[p].x-m.x<e+g.width)continue a;for(p=l+1;p<b;p++)if(a[p].x>m.x&&a[p].y-m.y<f+g.height)continue a;k=l;h=n}}return k}ss.prototype.Sv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
ss.prototype.addComments=function(a){var b=a.node;if(null!==b)for(b=b.fw();b.next();){var c=b.value;if("Comment"===c.category&&c.isVisible()){var d=this.network.vj(c);null===d&&(d=this.network.wk(c));d.charge=this.defaultCommentElectricalCharge;c=null;for(var e=d.destinationEdges;e.next();){var f=e.value;if(f.toVertex===a){c=f;break}}if(null===c)for(e=d.sourceEdges;e.next();)if(f=e.value,f.fromVertex===a){c=f;break}null===c&&(c=this.network.Lk(a,d,null));c.length=this.defaultCommentSpringLength}}};
function Es(a,b){F&&(x(a,Ds,ss,"getNodeDistance:vertexA"),x(b,Ds,ss,"getNodeDistance:vertexB"));var c=a.bounds,d=c.x;a=c.y;var e=c.width;c=c.height;var f=b.bounds,g=f.x;b=f.y;var h=f.width;f=f.height;return d+e<g?a>b+f?(c=d+e-g,a=a-b-f,K.sqrt(c*c+a*a)):a+c<b?(d=d+e-g,a=a+c-b,K.sqrt(d*d+a*a)):g-(d+e):d>g+h?a>b+f?(c=d-g-h,a=a-b-f,K.sqrt(c*c+a*a)):a+c<b?(d=d-g-h,a=a+c-b,K.sqrt(d*d+a*a)):d-(g+h):a>b+f?a-(b+f):a+c<b?b-(a+c):.1}
function ws(a,b){F&&C(b,ss,"performIterations:num");a.Qh=null;for(b=a.No+b;a.No<b&&(a.No++,Fs(a)););a.Qh=null}
function Fs(a){null===a.Qh&&(a.Qh=a.network.vertexes.ta());var b=a.Qh;if(0>=b.length)return!1;var c=b[0];c.forceX=0;c.forceY=0;for(var d=c.centerX,e=d,f=c=c.centerY,g=1;g<b.length;g++){var h=b[g];h.forceX=0;h.forceY=0;var k=h.centerX;h=h.centerY;d=Math.min(d,k);e=Math.max(e,k);c=Math.min(c,h);f=Math.max(f,h)}(e=e-d>f-c)?b.sort(function(a,b){return null===a||null===b||a===b?0:a.centerX-b.centerX}):b.sort(function(a,b){return null===a||null===b||a===b?0:a.centerY-b.centerY});c=a.ig;var l=d=h=0;for(f=
0;f<b.length;f++){g=b[f];d=g.bounds;h=g.focus;k=d.x+h.x;var m=d.y+h.y;d=g.charge*a.electricalFieldX(k,m);l=g.charge*a.electricalFieldY(k,m);d+=g.mass*a.gravitationalFieldX(k,m);l+=g.mass*a.gravitationalFieldY(k,m);g.forceX+=d;g.forceY+=l;for(var n=f+1;n<b.length;n++){var p=b[n];if(p!==g){d=p.bounds;h=p.focus;l=d.x+h.x;var r=d.y+h.y;if(k-l>c||l-k>c){if(e)break}else if(m-r>c||r-m>c){if(!e)break}else{var q=Es(g,p);1>q?(d=a.randomNumberGenerator,null===d&&(a.randomNumberGenerator=d=new Gs),q=d.random(),
h=d.random(),k>l?(d=Math.abs(p.bounds.right-g.bounds.x),d=(1+d)*q):k<l?(d=Math.abs(p.bounds.x-g.bounds.right),d=-(1+d)*q):(d=Math.max(p.width,g.width),d=(1+d)*q-d/2),m>r?(l=Math.abs(p.bounds.bottom-g.bounds.y),l=(1+l)*h):k<l?(l=Math.abs(p.bounds.y-g.bounds.bottom),l=-(1+l)*h):(l=Math.max(p.height,g.height),l=(1+l)*h-l/2)):(h=-(g.charge*p.charge)/(q*q),d=(l-k)/q*h,l=(r-m)/q*h);g.forceX+=d;g.forceY+=l;p.forceX-=d;p.forceY-=l}}}}for(e=a.network.edges.iterator;e.next();)h=e.value,c=h.fromVertex,f=h.toVertex,
g=c.bounds,k=c.focus,d=g.x+k.x,g=g.y+k.y,m=f.bounds,n=f.focus,k=m.x+n.x,m=m.y+n.y,n=Es(c,f),1>n?(n=a.randomNumberGenerator,null===n&&(a.randomNumberGenerator=n=new Gs),h=n.random(),n=n.random(),d=(d>k?1:-1)*(1+(f.width>c.width?f.width:c.width))*h,l=(g>m?1:-1)*(1+(f.height>c.height?f.height:c.height))*n):(h=h.stiffness*(n-h.length),d=(k-d)/n*h,l=(m-g)/n*h),c.forceX+=d,c.forceY+=l,f.forceX-=d,f.forceY-=l;for(e=d=0;e<b.length;e++)c=b[e],a.isFixed(c)?a.moveFixedVertex(c):d=Math.max(d,a.moveVertex(c)||
0);return d>a.epsilonDistance*a.epsilonDistance}ss.prototype.moveVertex=function(a){var b=a.forceX,c=a.forceY,d=this.moveLimit;b<-d?b=-d:b>d&&(b=d);c<-d?c=-d:c>d&&(c=d);a.centerX+=b;a.centerY+=c;return b*b+c*c};ss.prototype.moveFixedVertex=function(){};ss.prototype.commitLayout=function(){this.Qw();this.commitNodes();this.isRouting&&this.commitLinks()};
ss.prototype.Qw=function(){if(this.setsPortSpots)for(var a=this.network.edges.iterator;a.next();){var b=a.value.link;null!==b&&(b.fromSpot=ld,b.toSpot=ld)}};ss.prototype.commitNodes=function(){var a=0,b=0;if(this.arrangesToOrigin){var c=L.alloc();this.computeBounds(this.network,c);b=this.arrangementOrigin;a=b.x-c.x;b=b.y-c.y;L.free(c)}c=L.alloc();for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;if(0!==a||0!==b)c.assign(e.bounds),c.x+=a,c.y+=b,e.bounds=c;e.commit()}L.free(c)};
ss.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};ss.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.tl:a};ss.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.sl:a};ss.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.ql:a};ss.prototype.electricalFieldX=function(){return 0};ss.prototype.electricalFieldY=function(){return 0};
ss.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.rl:a};ss.prototype.gravitationalFieldX=function(){return 0};ss.prototype.gravitationalFieldY=function(){return 0};ss.prototype.isFixed=function(a){return a.isFixed};
ma.Object.defineProperties(ss.prototype,{currentIteration:{configurable:!0,get:function(){return this.No}},arrangementSpacing:{configurable:!0,get:function(){return this.Od},set:function(a){x(a,Hb,ss,"arrangementSpacing");this.Od.A(a)||(this.Od.assign(a),this.D())}},arrangesToOrigin:{configurable:!0,get:function(){return this.An},set:function(a){this.An!==a&&(A(a,"boolean",ss,"arrangesToOrigin"),this.An=a,this.D())}},setsPortSpots:{configurable:!0,
get:function(){return this.vf},set:function(a){this.vf!==a&&(A(a,"boolean",ss,"setsPortSpots"),this.vf=a,this.D())}},comments:{configurable:!0,get:function(){return this.ld},set:function(a){this.ld!==a&&(A(a,"boolean",ss,"comments"),this.ld=a,this.D())}},maxIterations:{configurable:!0,get:function(){return this.Yl},set:function(a){this.Yl!==a&&(A(a,"number",ss,"maxIterations"),0<=a&&(this.Yl=a,this.D()))}},epsilonDistance:{configurable:!0,get:function(){return this.ko},
set:function(a){this.ko!==a&&(A(a,"number",ss,"epsilonDistance"),0<a&&(this.ko=a,this.D()))}},infinityDistance:{configurable:!0,get:function(){return this.ig},set:function(a){this.ig!==a&&(A(a,"number",ss,"infinityDistance"),1<a&&(this.ig=a,this.D()))}},moveLimit:{configurable:!0,get:function(){return this.lp},set:function(a){this.lp!==a&&(A(a,"number",ss,"moveLimit"),1<a&&(this.lp=a,this.D()))}},randomNumberGenerator:{configurable:!0,get:function(){return this.Kp},
set:function(a){this.Kp!==a&&(null!==a&&"function"!==typeof a.random&&v('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.Kp=a)}},defaultSpringStiffness:{configurable:!0,get:function(){return this.tl},set:function(a){this.tl!==a&&(A(a,"number",ss,"defaultSpringStiffness"),this.tl=a,this.D())}},defaultSpringLength:{configurable:!0,get:function(){return this.sl},set:function(a){this.sl!==a&&(A(a,"number",ss,"defaultSpringLength"),
this.sl=a,this.D())}},defaultElectricalCharge:{configurable:!0,get:function(){return this.ql},set:function(a){this.ql!==a&&(A(a,"number",ss,"defaultElectricalCharge"),this.ql=a,this.D())}},defaultGravitationalMass:{configurable:!0,get:function(){return this.rl},set:function(a){this.rl!==a&&(A(a,"number",ss,"defaultGravitationalMass"),this.rl=a,this.D())}},defaultCommentSpringLength:{configurable:!0,get:function(){return this.$n},set:function(a){this.$n!==
a&&(A(a,"number",ss,"defaultCommentSpringLength"),this.$n=a,this.D())}},defaultCommentElectricalCharge:{configurable:!0,get:function(){return this.Zn},set:function(a){this.Zn!==a&&(A(a,"number",ss,"defaultCommentElectricalCharge"),this.Zn=a,this.D())}}});ss.className="ForceDirectedLayout";function Cs(){this.px=this.ox=this.Bu=this.Du=this.Cu=0}Cs.className="ForceDirectedSubnet";function ts(a){iq.call(this,a)}la(ts,iq);ts.prototype.createVertex=function(){return new Ds(this)};
ts.prototype.createEdge=function(){return new Hs(this)};ts.className="ForceDirectedNetwork";function Ds(a){wq.call(this,a);this.Pa=!1;this.jb=this.L=NaN;this.ci=this.Kd=this.Oa=this.W=0;this.Xe=this.zk=null;this.Mw=0}la(Ds,wq);Ds.prototype.serializeVertexProperties=function(a,b){wq.prototype.serializeVertexProperties.call(this,a,b);a.isFixed=this.isFixed;a.charge=this.charge;a.mass=this.mass};
Ds.prototype.Nq=function(a,b,c,d){wq.prototype.Nq.call(this,a,b,c,d);this.isFixed=a.isFixed;this.charge=a.charge;this.mass=a.mass};
ma.Object.defineProperties(Ds.prototype,{isFixed:{configurable:!0,get:function(){return this.Pa},set:function(a){this.Pa!==a&&(A(a,"boolean",Ds,"isFixed"),this.Pa=a)}},charge:{configurable:!0,get:function(){return this.L},set:function(a){this.L!==a&&(A(a,"number",Ds,"charge"),this.L=a)}},mass:{configurable:!0,get:function(){return this.jb},set:function(a){this.jb!==a&&(A(a,"number",Ds,"mass"),this.jb=a)}},forceX:{configurable:!0,get:function(){return this.W},
set:function(a){this.W!==a&&(A(a,"number",Ds,"forceX"),this.W=a)}},forceY:{configurable:!0,get:function(){return this.Oa},set:function(a){this.Oa!==a&&(A(a,"number",Ds,"forceY"),this.Oa=a)}}});Ds.className="ForceDirectedVertex";function Hs(a){xq.call(this,a);this.l=this.w=NaN}la(Hs,xq);Hs.prototype.serializeEdgeProperties=function(a,b){xq.prototype.serializeEdgeProperties.call(this,a,b);a.stiffness=this.stiffness;a.length=this.length};
Hs.prototype.deserializeEdgeProperties=function(a,b,c,d){xq.prototype.deserializeEdgeProperties.call(this,a,b,c,d);this.stiffness=a.stiffness;this.length=a.length};ma.Object.defineProperties(Hs.prototype,{stiffness:{configurable:!0,get:function(){return this.w},set:function(a){this.w!==a&&(A(a,"number",Hs,"stiffness"),this.w=a)}},length:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(A(a,"number",Hs,"length"),this.l=a)}}});Hs.className="ForceDirectedEdge";
function Gs(){var a=0;void 0===a&&(a=42);this.seed=a;this.lz=48271;this.nz=2147483647;this.Q=44488.07041494893;this.oz=3399;this.mz=1/2147483647;this.random()}Gs.prototype.random=function(){var a=this.seed%this.Q*this.lz-this.seed/this.Q*this.oz;0<a?this.seed=a:this.seed=a+this.nz;return this.seed*this.mz};Gs.className="RandomNumberGenerator";
function Is(){0<arguments.length&&za(Is);Mi.call(this);this.ec=this.Ae=25;this.M=0;this.ol=Js;this.Tl=Ks;this.Il=Ls;this.$j=4;this.dl=Ms;this.zg=7;this.vf=!0;this.Vo=4;this.Ga=this.Ti=this.xa=-1;this.tc=this.xh=0;this.Na=this.zd=this.Ad=this.Yd=this.Eb=null;this.zh=0;this.op=this.ek=null;this.Kc=0;this.pp=null;this.Yc=new J;this.Ee=[];this.Ee.length=100}la(Is,Mi);
Is.prototype.cloneProtected=function(a){Mi.prototype.cloneProtected.call(this,a);a.Ae=this.Ae;a.ec=this.ec;a.M=this.M;a.ol=this.ol;a.Tl=this.Tl;a.Il=this.Il;a.$j=this.$j;a.dl=this.dl;a.zg=this.zg;a.vf=this.vf;a.Vo=this.Vo};
Is.prototype.serializeLayoutProperties=function(a,b){Mi.prototype.serializeLayoutProperties.call(this,a,b);a.layerSpacing=this.layerSpacing;a.columnSpacing=this.columnSpacing;a.direction=this.direction;a.cycleRemoveOption=this.cycleRemoveOption.name;a.layeringOption=this.layeringOption.name;a.initializeOption=this.initializeOption.name;a.iterations=this.iterations;a.aggressiveOption=this.aggressiveOption.name;a.packOption=this.packOption;a.setsPortSpots=this.setsPortSpots;a.linkSpacing=this.linkSpacing;
a.xa=this.xa;a.Ti=this.Ti;a.Ga=this.Ga;a.xh=this.xh;a.tc=this.tc;a.Eb=this.Eb;a.zh=this.zh;a.Kc=this.Kc;a.Yc={x:this.Yc.x,y:this.Yc.y}};
Is.prototype.deserializeLayoutProperties=function(a,b,c,d){Mi.prototype.deserializeLayoutProperties.call(this,a,b,c,d);this.layerSpacing=a.layerSpacing;this.columnSpacing=a.columnSpacing;this.direction=a.direction;this.cycleRemoveOption=gb(Is,a.cycleRemoveOption);this.layeringOption=gb(Is,a.layeringOption);this.initializeOption=gb(Is,a.initializeOption);this.iterations=a.iterations;this.aggressiveOption=gb(Is,a.aggressiveOption);this.packOption=a.packOption;this.setsPortSpots=a.setsPortSpots;this.linkSpacing=
a.linkSpacing;this.xa=a.xa;this.Ti=a.Ti;this.Ga=a.Ga;this.xh=a.xh;this.tc=a.tc;this.Eb=a.Eb;this.zh=a.zh;this.Kc=a.Kc;this.Yc=new J(this.Yc.x,this.Yc.y)};Is.prototype.nb=function(a){a.classType===Is?0===a.name.indexOf("Aggressive")?this.aggressiveOption=a:0===a.name.indexOf("Cycle")?this.cycleRemoveOption=a:0===a.name.indexOf("Init")?this.initializeOption=a:0===a.name.indexOf("Layer")?this.layeringOption=a:v("Unknown enum value: "+a):Mi.prototype.nb.call(this,a)};Is.prototype.createNetwork=function(){return new Ns(this)};
Is.prototype.doLayout=function(a){F&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);this.Ti=-1;this.tc=this.xh=0;this.pp=this.op=this.ek=null;for(a=0;a<this.Ee.length;a++)this.Ee[a]=null;if(0<this.network.vertexes.count){this.network.Mq();if(this.ix())return;this.cycleRemoveOption!==Os&&this.removeCycles();for(a=
this.network.vertexes.iterator;a.next();)a.value.layer=-1;this.xa=-1;this.assignLayers();for(a.reset();a.next();)this.xa=Math.max(this.xa,a.value.layer);this.cycleRemoveOption===Os&&this.removeCycles();a=this.network;for(var b=[],c=a.edges.iterator;c.next();){var d=c.value;d.valid=!1;b.push(d)}for(c=0;c<b.length;c++){d=b[c];var e=d.fromVertex,f=d.toVertex;if(!(d.valid||(null===e.node&&null===e.data||null===f.node&&null===f.data)&&e.layer===f.layer)){var g=0,h=0,k=0,l=0;if(null!==d.link){h=d.link;
if(null===h)continue;var m=e.node;g=f.node;if(null===m||null===g)continue;var n=h.fromNode;k=h.toNode;var p=h.fromPort;h=h.toPort;if(d.rev){l=n;var r=p;n=k;p=h;k=l;h=r}var q=e.focus;l=f.focus;var u=d.rev?f.bounds:e.bounds;r=J.alloc();m!==n?u.o()&&n.isVisible()?n.actualBounds.o()?(n.Of(p,Mc,r),r.x+=n.actualBounds.x-u.x,r.y+=n.actualBounds.y-u.y):(n.Of(p,Mc,r),r.o()||r.assign(q)):r.assign(q):u.o()?(n.Of(p,Mc,r),r.o()||r.assign(q)):r.assign(q);n=d.rev?e.bounds:f.bounds;m=J.alloc();g!==k?n.o()&&k.isVisible()?
k.actualBounds.o()?(k.Of(h,Mc,m),m.x+=k.actualBounds.x-n.x,m.y+=k.actualBounds.y-n.y):(k.Of(h,Mc,m),m.o()||m.assign(l)):m.assign(l):n.o()?(k.Of(h,Mc,m),m.o()||m.assign(l)):m.assign(l);90===this.M||270===this.M?(g=Math.round((r.x-q.x)/this.ec),k=r.x,h=Math.round((m.x-l.x)/this.ec),l=m.x):(g=Math.round((r.y-q.y)/this.ec),k=r.y,h=Math.round((m.y-l.y)/this.ec),l=m.y);J.free(r);J.free(m);d.portFromColOffset=g;d.portFromPos=k;d.portToColOffset=h;d.portToPos=l}else d.portFromColOffset=0,d.portFromPos=0,
d.portToColOffset=0,d.portToPos=0;r=e.layer;m=f.layer;n=0;u=d.link;if(null!==u){var w=u.fromPort,y=u.toPort;if(null!==w&&null!==y){var z=u.fromNode;p=u.toNode;if(null!==z&&null!==p){var B=Ps(this,!0),D=Ps(this,!1),G=this.setsPortSpots?B:u.computeSpot(!0,w);q=this.setsPortSpots?D:u.computeSpot(!1,y);var O=u.isOrthogonal;G.Sc()&&G.Pf(D)&&q.Sc()&&q.Pf(B)?n=0:(B=u.getLinkPoint(z,w,G,!0,O,p,y,J.alloc()),D=u.getLinkDirection(z,w,B,G,!0,O,p,y),J.free(B),G.ar()||D!==Qs(this,d,!0)?this.setsPortSpots&&null!==
z&&1===z.ports.count&&d.rev&&(n+=1):n+=1,G=u.getLinkPoint(p,y,q,!1,O,z,w,J.alloc()),u=u.getLinkDirection(p,y,G,q,!1,O,z,w),J.free(G),q.ar()||u!==Qs(this,d,!1)?this.setsPortSpots&&null!==p&&1===p.ports.count&&d.rev&&(n+=2):n+=2)}}}p=n;n=1===p||3===p?!0:!1;if(p=2===p||3===p?!0:!1)q=a.createVertex(),q.node=null,q.If=1,q.layer=r,q.near=e,a.Ng(q),e=a.Lk(e,q,d.link),e.valid=!1,e.rev=d.rev,e.portFromColOffset=g,e.portToColOffset=0,e.portFromPos=k,e.portToPos=0,e=q;u=1;n&&u--;if(r-m>u&&0<r){d.valid=!1;q=
a.createVertex();q.node=null;q.If=2;q.layer=r-1;a.Ng(q);e=a.Lk(e,q,d.link);e.valid=!0;e.rev=d.rev;e.portFromColOffset=p?0:g;e.portToColOffset=0;e.portFromPos=p?0:k;e.portToPos=0;e=q;for(r--;r-m>u&&0<r;)q=a.createVertex(),q.node=null,q.If=3,q.layer=r-1,a.Ng(q),e=a.Lk(e,q,d.link),e.valid=!0,e.rev=d.rev,e.portFromColOffset=0,e.portToColOffset=0,e.portFromPos=0,e.portToPos=0,e=q,r--;e=a.Lk(q,f,d.link);e.valid=!n;n&&(q.near=f);e.rev=d.rev;e.portFromColOffset=0;e.portToColOffset=h;e.portFromPos=0;e.portToPos=
l}else d.valid=!0}}a=this.Eb=[];for(b=0;b<=this.xa;b++)a[b]=0;for(b=this.network.vertexes.iterator;b.next();)b.value.index=-1;this.initializeIndices();this.Ti=-1;for(c=this.tc=this.xh=0;c<=this.xa;c++)a[c]>a[this.tc]&&(this.Ti=a[c]-1,this.tc=c),a[c]<a[this.xh]&&(this.xh=c);this.pp=[];for(c=0;c<a.length;c++)this.pp[c]=[];for(b.reset();b.next();)a=b.value,this.pp[a.layer][a.index]=a;this.Ga=-1;for(a=0;a<=this.xa;a++){b=Rs(this,a);c=0;d=this.Eb[a];for(f=0;f<d;f++)e=b[f],c+=this.nodeMinColumnSpace(e,
!0),e.column=c,c+=1,c+=this.nodeMinColumnSpace(e,!1);this.Ga=Math.max(this.Ga,c-1);Ss(this,a,b)}this.reduceCrossings();this.straightenAndPack();this.updateParts()}this.network=null;this.isValidLayout=!0};Is.prototype.linkMinLength=function(){return 1};function Ts(a){var b=a.fromVertex.node||a.fromVertex.data;a=a.toVertex.node||a.toVertex.data;return null===b&&null===a?8:null===b||null===a?4:1}
Is.prototype.nodeMinLayerSpace=function(a,b){return null===a.node&&null===a.data?0:90===this.M||270===this.M?b?a.focus.y+10:a.bounds.height-a.focus.y+10:b?a.focus.x+10:a.bounds.width-a.focus.x+10};Is.prototype.nodeMinColumnSpace=function(a,b){if(null===a.node&&null===a.data)return 0;var c=b?a.Tk:a.Sk;if(null!==c)return c;c=this.M;return 90===c||270===c?b?a.Tk=a.focus.x/this.ec+1|0:a.Sk=(a.bounds.width-a.focus.x)/this.ec+1|0:b?a.Tk=a.focus.y/this.ec+1|0:a.Sk=(a.bounds.height-a.focus.y)/this.ec+1|0};
function Us(a){null===a.ek&&(a.ek=[]);for(var b=0,c=a.network.vertexes.iterator;c.next();){var d=c.value;a.ek[b]=d.layer;b++;a.ek[b]=d.column;b++;a.ek[b]=d.index;b++}return a.ek}function Vs(a,b){var c=0;for(a=a.network.vertexes.iterator;a.next();){var d=a.value;d.layer=b[c];c++;d.column=b[c];c++;d.index=b[c];c++}}
function Ws(a,b,c){F&&(C(b,Is,"crossingMatrix:unfixedLayer"),C(c,Is,"crossingMatrix:direction"));var d=Rs(a,b),e=a.Eb[b];if(null===a.op||a.op.length<e*e)a.op=[];for(var f=a.op,g=0;g<e;g++){var h=0,k=d[g],l=k.near;if(null!==l&&l.layer===k.layer)if(k=l.index,k>g)for(var m=g+1;m<k;m++){var n=d[m];n.near===l&&n.If===l.If||h++}else for(m=g-1;m>k;m--)n=d[m],n.near===l&&n.If===l.If||h++;var p;if(0<=c)for(k=d[g].sourceEdgesArrayAccess,l=0;l<k.length;l++){var r=k[l];if(r.valid&&r.fromVertex.layer!==b)for(n=
r.fromVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++){var q=k[p];if(q.valid&&q.fromVertex.layer!==b){var u=q.fromVertex.index;var w=q.portToPos;q=q.portFromPos;m<w&&(n>u||n===u&&r>q)&&h++;w<m&&(u>n||u===n&&q>r)&&h++}}}if(0>=c)for(k=d[g].destinationEdgesArrayAccess,l=0;l<k.length;l++)if(r=k[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++)q=k[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,w=q.portToPos,q=q.portFromPos,
r<q&&(n>u||n===u&&m>w)&&h++,q<r&&(u>n||u===n&&w>m)&&h++);f[g*e+g]=h;for(k=g+1;k<e;k++){var y=0,z=0;if(0<=c){h=d[g].sourceEdgesArrayAccess;var B=d[k].sourceEdgesArrayAccess;for(l=0;l<h.length;l++)if(r=h[l],r.valid&&r.fromVertex.layer!==b)for(n=r.fromVertex.index,r=r.portFromPos,p=0;p<B.length;p++)q=B[p],q.valid&&q.fromVertex.layer!==b&&(u=q.fromVertex.index,q=q.portFromPos,(n<u||n===u&&r<q)&&z++,(u<n||u===n&&q<r)&&y++)}if(0>=c)for(h=d[g].destinationEdgesArrayAccess,B=d[k].destinationEdgesArrayAccess,
l=0;l<h.length;l++)if(r=h[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,m=r.portToPos,p=0;p<B.length;p++)q=B[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,w=q.portToPos,(n<u||n===u&&m<w)&&z++,(u<n||u===n&&w<m)&&y++);f[g*e+k]=y;f[k*e+g]=z}}Ss(a,b,d);return f}Is.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.xa;b++)for(var c=Ws(this,b,1),d=this.Eb[b],e=0;e<d;e++)for(var f=e;f<d;f++)a+=c[e*d+f];return a};
function Xs(a){for(var b=0,c=0;c<=a.xa;c++){for(var d=a,e=c,f=Rs(d,e),g=d.Eb[e],h=0,k=0;k<g;k++){var l=f[k].destinationEdgesArrayAccess;if(null!==l)for(var m=0;m<l.length;m++){var n=l[m];if(n.valid&&n.toVertex.layer!==e){var p=n.fromVertex.column+n.portFromColOffset;var r=n.toVertex.column+n.portToColOffset;h+=(Math.abs(p-r)+1)*Ts(n)}}}Ss(d,e,f);b+=h}return b}
Is.prototype.normalize=function(){var a=Infinity;this.Ga=-1;for(var b=this.network.vertexes.iterator;b.next();){var c=b.value;a=Math.min(a,c.column-this.nodeMinColumnSpace(c,!0));this.Ga=Math.max(this.Ga,c.column+this.nodeMinColumnSpace(c,!1))}for(b.reset();b.next();)b.value.column-=a;this.Ga-=a};
function Ys(a,b,c){F&&(C(b,Is,"barycenters:unfixedLayer"),C(c,Is,"barycenters:direction"));for(var d=Rs(a,b),e=a.Eb[b],f=[],g=0;g<e;g++){var h=d[g],k=null;0>=c&&(k=h.sourceEdgesArrayAccess);var l=null;0<=c&&(l=h.destinationEdgesArrayAccess);var m=0,n=0,p=h.near;null!==p&&p.layer===h.layer&&(m+=p.column-1,n++);if(null!==k)for(p=0;p<k.length;p++){h=k[p];var r=h.fromVertex;h.valid&&!h.rev&&r.layer!==b&&(m+=r.column,n++)}if(null!==l)for(k=0;k<l.length;k++)h=l[k],p=h.toVertex,h.valid&&!h.rev&&p.layer!==
b&&(m+=p.column,n++);f[g]=0===n?-1:m/n}Ss(a,b,d);return f}
function Zs(a,b,c){F&&(C(b,Is,"medians:unfixedLayer"),C(c,Is,"medians:direction"));for(var d=Rs(a,b),e=a.Eb[b],f=[],g=0;g<e;g++){var h=d[g],k=null;0>=c&&(k=h.sourceEdgesArrayAccess);var l=null;0<=c&&(l=h.destinationEdgesArrayAccess);var m=0,n=[],p=h.near;null!==p&&p.layer===h.layer&&(n[m]=p.column-1,m++);h=void 0;if(null!==k)for(p=0;p<k.length;p++){h=k[p];var r=h.fromVertex;h.valid&&!h.rev&&r.layer!==b&&(n[m]=r.column+h.portFromColOffset,m++)}if(null!==l)for(k=0;k<l.length;k++)h=l[k],p=h.toVertex,
h.valid&&!h.rev&&p.layer!==b&&(n[m]=p.column+h.portToColOffset,m++);0===m?f[g]=-1:(n.sort(function(a,b){return a-b}),l=m>>1,f[g]=0!==(m&1)?n[l]:n[l-1]+n[l]>>1)}Ss(a,b,d);return f}
function $s(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();){var h=g.value;var k=h.toVertex;var l=b.layer-k.layer;h=a.linkMinLength(h);l===h&&$s(a,k,c,d,e,f)}if(f)for(g=b.sourceEdges;g.next();)h=g.value,k=h.fromVertex,l=k.layer-b.layer,h=a.linkMinLength(h),l===h&&$s(a,k,c,d,e,f)}}
function at(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();)at(a,g.value.toVertex,c,d,e,f);if(f)for(b=b.sourceEdges;b.next();)at(a,b.value.fromVertex,c,d,e,f)}}
Is.prototype.removeCycles=function(){for(var a=this.network.edges.iterator;a.next();)a.value.rev=!1;switch(this.ol){default:case bt:a=this.network;var b=0,c=a.vertexes.count-1,d=[];d.length=c+1;for(var e=a.vertexes.iterator;e.next();)e.value.valid=!0;for(;null!==ct(a);){for(e=dt(a);null!==e;)d[c]=e,c--,e.valid=!1,e=dt(a);for(e=et(a);null!==e;)d[b]=e,b++,e.valid=!1,e=et(a);e=null;for(var f=0,g=this.network.vertexes.iterator;g.next();){var h=g.value;if(h.valid){for(var k=0,l=h.destinationEdges;l.next();)l.value.toVertex.valid&&
k++;l=0;for(var m=h.sourceEdges;m.next();)m.value.fromVertex.valid&&l++;if(null===e||f<k-l)e=h,f=k-l}}null!==e&&(d[b]=e,b++,e.valid=!1)}for(b=0;b<a.vertexes.count;b++)d[b].index=b;for(d=a.edges.iterator;d.next();)b=d.value,b.fromVertex.index>b.toVertex.index&&(a.dn(b),b.rev=!0);break;case Js:for(d=this.network.vertexes.iterator;d.next();)a=d.value,a.Og=-1,a.finish=-1;for(a=this.network.edges.iterator;a.next();)a.value.forest=!1;this.zh=0;for(d.reset();d.next();)b=d.value,0===b.sourceEdges.count&&
ft(this,b);for(d.reset();d.next();)b=d.value,-1===b.Og&&ft(this,b);for(a.reset();a.next();)d=a.value,d.forest||(b=d.fromVertex,c=b.finish,e=d.toVertex,f=e.finish,e.Og<b.Og&&c<f&&(this.network.dn(d),d.rev=!0));break;case Os:a=this.network;b=a.vertexes.iterator;for(d=Infinity;b.next();)d=Math.min(d,b.value.layer);if(Infinity>d){if(0>d)for(b.reset();b.next();)b.value.layer-=d;d=[];for(b.reset();b.next();)c=b.value,e=d[c.layer],void 0===e?d[c.layer]=[c]:e.push(c);for(c=b=0;c<d.length;c++)if(e=d[c],!e||
0===e.length)b++;else if(0<c)for(f=0;f<e.length;f++)e[f].layer-=b;for(d=a.edges.iterator;d.next();)b=d.value,b.fromVertex.layer<b.toVertex.layer&&(a.dn(b),b.rev=!0)}}};function ct(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid)return b}return null}function dt(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.destinationEdges;d.next();)if(d.value.toVertex.valid){c=!1;break}if(c)return b}}return null}
function et(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.sourceEdges;d.next();)if(d.value.fromVertex.valid){c=!1;break}if(c)return b}}return null}function ft(a,b){b.Og=a.zh;a.zh++;for(var c=b.destinationEdges;c.next();){var d=c.value,e=d.toVertex;-1===e.Og&&(d.forest=!0,ft(a,e))}b.finish=a.zh;a.zh++}
Is.prototype.assignLayers=function(){switch(this.Tl){case gt:ht(this);break;case it:for(var a,b=this.network.vertexes.iterator;b.next();)a=jt(this,b.value),this.xa=Math.max(a,this.xa);for(b.reset();b.next();)a=b.value,a.layer=this.xa-a.layer;break;default:case Ks:ht(this);for(b=this.network.vertexes.iterator;b.next();)b.value.valid=!1;for(b.reset();b.next();)a=b.value,0===a.sourceEdges.count&&kt(this,a);a=Infinity;for(b.reset();b.next();)a=Math.min(a,b.value.layer);this.xa=-1;for(b.reset();b.next();){var c=
b.value;c.layer-=a;this.xa=Math.max(this.xa,c.layer)}}};function ht(a){for(var b=a.network.vertexes.iterator;b.next();){var c=lt(a,b.value);a.xa=Math.max(c,a.xa)}}function lt(a,b){var c=0;if(-1===b.layer){for(var d=b.destinationEdges;d.next();){var e=d.value,f=e.toVertex;e=a.linkMinLength(e);c=Math.max(c,lt(a,f)+e)}b.layer=c}else c=b.layer;return c}
function jt(a,b){var c=0;if(-1===b.layer){for(var d=b.sourceEdges;d.next();){var e=d.value,f=e.fromVertex;e=a.linkMinLength(e);c=Math.max(c,jt(a,f)+e)}b.layer=c}else c=b.layer;return c}
function kt(a,b){if(!b.valid){b.valid=!0;for(var c=b.destinationEdges;c.next();)kt(a,c.value.toVertex);for(c=a.network.vertexes.iterator;c.next();)c.value.component=-1;for(var d=b.sourceEdgesArrayAccess,e=d.length,f=0;f<e;f++){var g=d[f],h=g.fromVertex,k=g.toVertex;g=a.linkMinLength(g);h.layer-k.layer>g&&$s(a,h,0,-1,!0,!1)}for($s(a,b,1,-1,!0,!0);0!==b.component;){f=0;d=Infinity;h=0;k=null;for(g=a.network.vertexes.iterator;g.next();){var l=g.value;if(1===l.component){var m=0,n=!1,p=l.sourceEdgesArrayAccess;
e=p.length;for(var r=0;r<e;r++){var q=p[r],u=q.fromVertex;m+=1;1!==u.component&&(f+=1,u=u.layer-l.layer,q=a.linkMinLength(q),d=Math.min(d,u-q))}p=l.destinationEdgesArrayAccess;e=p.length;for(r=0;r<e;r++)q=p[r].toVertex,--m,1!==q.component?--f:n=!0;(null===k||m<h)&&!n&&(k=l,h=m)}}if(0<f){for(c.reset();c.next();)e=c.value,1===e.component&&(e.layer+=d);b.component=0}else k.component=0}for(c=a.network.vertexes.iterator;c.next();)c.value.component=-1;for($s(a,b,1,-1,!0,!1);0!==b.component;){d=0;e=Infinity;
f=0;h=null;for(k=a.network.vertexes.iterator;k.next();)if(g=k.value,1===g.component){l=0;m=!1;p=g.sourceEdgesArrayAccess;n=p.length;for(r=0;r<n;r++)q=p[r].fromVertex,l+=1,1!==q.component?d+=1:m=!0;p=g.destinationEdgesArrayAccess;n=p.length;for(r=0;r<n;r++)q=p[r],u=q.toVertex,--l,1!==u.component&&(--d,u=g.layer-u.layer,q=a.linkMinLength(q),e=Math.min(e,u-q));(null===h||l>f)&&!m&&(h=g,f=l)}if(0>d){for(c.reset();c.next();)d=c.value,1===d.component&&(d.layer-=e);b.component=0}else h.component=0}}}
function Qs(a,b,c){return 90===a.M?c&&!b.rev||!c&&b.rev?270:90:180===a.M?c&&!b.rev||!c&&b.rev?0:180:270===a.M?c&&!b.rev||!c&&b.rev?90:270:c&&!b.rev||!c&&b.rev?180:0}
Is.prototype.initializeIndices=function(){switch(this.Il){default:case mt:for(var a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;b.index=this.Eb[c];this.Eb[c]++}break;case Ls:a=this.network.vertexes.iterator;for(b=this.xa;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&nt(this,c);break;case ot:for(a=this.network.vertexes.iterator,b=0;b<=this.xa;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&pt(this,c)}};
function nt(a,b){var c=b.layer;b.index=a.Eb[c];a.Eb[c]++;b=b.destinationEdgesArrayAccess;for(c=!0;c;){c=!1;for(var d=0;d<b.length-1;d++){var e=b[d],f=b[d+1];e.portFromColOffset>f.portFromColOffset&&(c=!0,b[d]=f,b[d+1]=e)}}for(c=0;c<b.length;c++)d=b[c],d.valid&&(d=d.toVertex,-1===d.index&&nt(a,d))}
function pt(a,b){var c=b.layer;b.index=a.Eb[c];a.Eb[c]++;b=b.sourceEdgesArrayAccess;for(var d=!0;d;)for(d=!1,c=0;c<b.length-1;c++){var e=b[c],f=b[c+1];e.portToColOffset>f.portToColOffset&&(d=!0,b[c]=f,b[c+1]=e)}for(c=0;c<b.length;c++)d=b[c],d.valid&&(d=d.fromVertex,-1===d.index&&pt(a,d))}
Is.prototype.reduceCrossings=function(){var a=this.countCrossings(),b=Us(this),c,d;for(c=0;c<this.$j;c++){for(d=0;d<=this.xa;d++)qt(this,d,1),rt(this,d,1);var e=this.countCrossings();e<a&&(a=e,b=Us(this));for(d=this.xa;0<=d;d--)qt(this,d,-1),rt(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=Us(this))}Vs(this,b);for(c=0;c<this.$j;c++){for(d=0;d<=this.xa;d++)qt(this,d,0),rt(this,d,0);e=this.countCrossings();e<a&&(a=e,b=Us(this));for(d=this.xa;0<=d;d--)qt(this,d,0),rt(this,d,0);e=this.countCrossings();
e<a&&(a=e,b=Us(this))}Vs(this,b);var f,g,h;switch(this.dl){case st:break;case tt:for(h=a+1;(d=this.countCrossings())<h;)for(h=d,c=this.xa;0<=c;c--)for(g=0;g<=c;g++){for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=rt(this,d,-1)||f;e=this.countCrossings();e>=a?Vs(this,b):(a=e,b=Us(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=rt(this,d,1)||f;e=this.countCrossings();e>=a?Vs(this,b):(a=e,b=Us(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=rt(this,d,1)||f;e>=a?Vs(this,b):(a=e,b=Us(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=
rt(this,d,-1)||f;e>=a?Vs(this,b):(a=e,b=Us(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=rt(this,d,0)||f;e>=a?Vs(this,b):(a=e,b=Us(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=rt(this,d,0)||f;e>=a?Vs(this,b):(a=e,b=Us(this))}break;default:case Ms:for(c=this.xa,g=0,h=a+1;(d=this.countCrossings())<h;){h=d;for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=rt(this,d,-1)||f;e=this.countCrossings();e>=a?Vs(this,b):(a=e,b=Us(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=rt(this,d,1)||f;e=this.countCrossings();e>=a?Vs(this,b):
(a=e,b=Us(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=rt(this,d,1)||f;e>=a?Vs(this,b):(a=e,b=Us(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=rt(this,d,-1)||f;e>=a?Vs(this,b):(a=e,b=Us(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=rt(this,d,0)||f;e>=a?Vs(this,b):(a=e,b=Us(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=rt(this,d,0)||f;e>=a?Vs(this,b):(a=e,b=Us(this))}}Vs(this,b)};
function qt(a,b,c){F&&(C(b,Is,"medianBarycenterCrossingReduction:unfixedLayer"),C(c,Is,"medianBarycenterCrossingReduction:direction"));var d=Rs(a,b),e=a.Eb[b],f=Zs(a,b,c),g=Ys(a,b,c);for(c=0;c<e;c++)-1===g[c]&&(g[c]=d[c].column),-1===f[c]&&(f[c]=d[c].column);for(var h=!0,k;h;)for(h=!1,c=0;c<e-1;c++)if(f[c+1]<f[c]||f[c+1]===f[c]&&g[c+1]<g[c])h=!0,k=f[c],f[c]=f[c+1],f[c+1]=k,k=g[c],g[c]=g[c+1],g[c+1]=k,k=d[c],d[c]=d[c+1],d[c+1]=k;for(c=f=0;c<e;c++)k=d[c],k.index=c,f+=a.nodeMinColumnSpace(k,!0),k.column=
f,f+=1,f+=a.nodeMinColumnSpace(k,!1);Ss(a,b,d)}
function rt(a,b,c){var d=Rs(a,b),e=a.Eb[b];c=Ws(a,b,c);var f;var g=[];for(f=0;f<e;f++)g[f]=-1;var h=[];for(f=0;f<e;f++)h[f]=-1;for(var k=!1,l=!0;l;)for(l=!1,f=0;f<e-1;f++){var m=c[d[f].index*e+d[f+1].index],n=c[d[f+1].index*e+d[f].index],p=0,r=0,q=d[f].column,u=d[f+1].column,w=a.nodeMinColumnSpace(d[f],!0),y=a.nodeMinColumnSpace(d[f],!1),z=a.nodeMinColumnSpace(d[f+1],!0),B=a.nodeMinColumnSpace(d[f+1],!1);w=q-w+z;y=u-y+B;var D=d[f].sourceEdges.iterator;for(D.reset();D.next();)if(z=D.value,B=z.fromVertex,
z.valid&&B.layer===b){for(z=0;d[z]!==B;)z++;z<f&&(p+=2*(f-z),r+=2*(f+1-z));z===f+1&&(p+=1);z>f+1&&(p+=4*(z-f),r+=4*(z-(f+1)))}D=d[f].destinationEdges.iterator;for(D.reset();D.next();)if(z=D.value,B=z.toVertex,z.valid&&B.layer===b){for(z=0;d[z]!==B;)z++;z===f+1&&(r+=1)}D=d[f+1].sourceEdges.iterator;for(D.reset();D.next();)if(z=D.value,B=z.fromVertex,z.valid&&B.layer===b){for(z=0;d[z]!==B;)z++;z<f&&(p+=2*(f+1-z),r+=2*(f-z));z===f&&(r+=1);z>f+1&&(p+=4*(z-(f+1)),r+=4*(z-f))}D=d[f+1].destinationEdges.iterator;
for(D.reset();D.next();)if(z=D.value,B=z.toVertex,z.valid&&B.layer===b){for(z=0;d[z]!==B;)z++;z===f&&(p+=1)}z=B=0;D=g[d[f].index];var G=h[d[f].index],O=g[d[f+1].index],T=h[d[f+1].index];-1!==D&&(B+=Math.abs(D-q),z+=Math.abs(D-y));-1!==G&&(B+=Math.abs(G-q),z+=Math.abs(G-y));-1!==O&&(B+=Math.abs(O-u),z+=Math.abs(O-w));-1!==T&&(B+=Math.abs(T-u),z+=Math.abs(T-w));if(r<p-.5||r===p&&n<m-.5||r===p&&n===m&&z<B-.5)l=k=!0,d[f].column=y,d[f+1].column=w,m=d[f],d[f]=d[f+1],d[f+1]=m}for(f=0;f<e;f++)d[f].index=
f;Ss(a,b,d);return k}
Is.prototype.straightenAndPack=function(){var a=0!==(this.zg&1);var b=7===this.zg;1E3<this.network.edges.count&&!b&&(a=!1);if(a){var c=[];for(b=0;b<=this.xa;b++)c[b]=0;for(var d,e=this.network.vertexes.iterator;e.next();){var f=e.value;b=f.layer;d=f.column;f=this.nodeMinColumnSpace(f,!1);c[b]=Math.max(c[b],d+f)}for(e.reset();e.next();)f=e.value,b=f.layer,d=f.column,f.column=(8*(this.Ga-c[b])>>1)+8*d;this.Ga*=8}if(0!==(this.zg&2))for(c=!0;c;){c=!1;for(b=this.tc+1;b<=this.xa;b++)c=ut(this,b,1)||c;for(b=
this.tc-1;0<=b;b--)c=ut(this,b,-1)||c;c=ut(this,this.tc,0)||c}if(0!==(this.zg&4)){for(b=this.tc+1;b<=this.xa;b++)vt(this,b,1);for(b=this.tc-1;0<=b;b--)vt(this,b,-1);vt(this,this.tc,0)}a&&(wt(this,-1),wt(this,1));if(0!==(this.zg&2))for(c=!0;c;){c=!1;c=ut(this,this.tc,0)||c;for(b=this.tc+1;b<=this.xa;b++)c=ut(this,b,0)||c;for(b=this.tc-1;0<=b;b--)c=ut(this,b,0)||c}};
function ut(a,b,c){F&&(C(b,Is,"bendStraighten:unfixedLayer"),C(c,Is,"bendStraighten:direction"));for(var d=!1;xt(a,b,c);)d=!0;return d}
function xt(a,b,c){F&&(C(b,Is,"shiftbendStraighten:unfixedLayer"),C(c,Is,"shiftbendStraighten:direction"));var d,e=Rs(a,b),f=a.Eb[b],g=Ys(a,b,-1);if(0<c)for(d=0;d<f;d++)g[d]=-1;var h=Ys(a,b,1);if(0>c)for(d=0;d<f;d++)h[d]=-1;for(var k=!1,l=!0;l;)for(l=!1,d=0;d<f;d++){var m=e[d].column,n=a.nodeMinColumnSpace(e[d],!0),p=a.nodeMinColumnSpace(e[d],!1),r=0;0>d-1||m-e[d-1].column-1>n+a.nodeMinColumnSpace(e[d-1],!1)?r=m-1:r=m;n=d+1>=f||e[d+1].column-m-1>p+a.nodeMinColumnSpace(e[d+1],!0)?m+1:m;var q=p=0,u=
0;if(0>=c)for(var w=e[d].sourceEdges.iterator;w.next();){var y=w.value;var z=y.fromVertex;if(y.valid&&z.layer!==b){var B=Ts(y);var D=y.portFromColOffset;y=y.portToColOffset;z=z.column;p+=(Math.abs(m+y-(z+D))+1)*B;q+=(Math.abs(r+y-(z+D))+1)*B;u+=(Math.abs(n+y-(z+D))+1)*B}}if(0<=c)for(w=e[d].destinationEdges.iterator;w.next();)y=w.value,z=y.toVertex,y.valid&&z.layer!==b&&(B=Ts(y),D=y.portFromColOffset,y=y.portToColOffset,z=z.column,p+=(Math.abs(m+D-(z+y))+1)*B,q+=(Math.abs(r+D-(z+y))+1)*B,u+=(Math.abs(n+
D-(z+y))+1)*B);y=D=B=0;w=g[e[d].index];z=h[e[d].index];-1!==w&&(B+=Math.abs(w-m),D+=Math.abs(w-r),y+=Math.abs(w-n));-1!==z&&(B+=Math.abs(z-m),D+=Math.abs(z-r),y+=Math.abs(z-n));if(q<p||q===p&&D<B)l=k=!0,e[d].column=r;else if(u<p||u===p&&y<B)l=k=!0,e[d].column=n}Ss(a,b,e);a.normalize();return k}
function vt(a,b,c){F&&(C(b,Is,"medianStraighten:unfixedLayer"),C(c,Is,"medianStraighten:direction"));var d=Rs(a,b),e=a.Eb[b],f=Zs(a,b,c),g=[];for(c=0;c<e;c++)g[c]=f[c];for(f=!0;f;)for(f=!1,c=0;c<e;c++){var h=d[c].column,k=a.nodeMinColumnSpace(d[c],!0),l=a.nodeMinColumnSpace(d[c],!1),m=0;if(-1===g[c])if(0===c&&c===e-1)m=h;else if(0===c){var n=d[c+1].column;n-h===l+a.nodeMinColumnSpace(d[c+1],!0)?m=h-1:m=h}else c===e-1?(n=d[c-1].column,m=h-n===k+a.nodeMinColumnSpace(d[c-1],!1)?h+1:h):(n=d[c-1].column,
k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+1],!0)-l-1,m=(k+l)/2|0);else 0===c&&c===e-1?m=g[c]:0===c?(n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+1],!0)-l-1,m=Math.min(g[c],l)):c===e-1?(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,m=Math.max(g[c],k)):(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+1],!0)-l-1,k<g[c]&&g[c]<l?m=g[c]:k>=g[c]?m=k:l<=g[c]&&(m=l));m!==h&&(f=!0,d[c].column=m)}Ss(a,b,
d);a.normalize()}function yt(a,b){F&&(C(b,Is,"packAux:column"),C(1,Is,"packAux:direction"));for(var c=!0,d=a.network.vertexes.iterator;d.next();){var e=d.value,f=a.nodeMinColumnSpace(e,!0),g=a.nodeMinColumnSpace(e,!1);if(e.column-f<=b&&e.column+g>=b){c=!1;break}}a=!1;if(c)for(d.reset();d.next();)c=d.value,c.column>b&&(--c.column,a=!0);return a}
function zt(a,b){F&&(C(b,Is,"tightPackAux:column"),C(1,Is,"tightPackAux:direction"));var c=b+1;var d,e=[],f=[];for(d=0;d<=a.xa;d++)e[d]=!1,f[d]=!1;for(var g=a.network.vertexes.iterator;g.next();){d=g.value;var h=d.column-a.nodeMinColumnSpace(d,!0),k=d.column+a.nodeMinColumnSpace(d,!1);h<=b&&k>=b&&(e[d.layer]=!0);h<=c&&k>=c&&(f[d.layer]=!0)}h=!0;c=!1;for(d=0;d<=a.xa;d++)h=h&&!(e[d]&&f[d]);if(h)for(g.reset();g.next();)a=g.value,a.column>b&&(--a.column,c=!0);return c}
function wt(a,b){F&&C(b,Is,"componentPack:direction");for(var c=0;c<=a.Ga;c++)for(;yt(a,c););a.normalize();for(c=0;c<a.Ga;c++)for(;zt(a,c););a.normalize();var d;if(0<b)for(c=0;c<=a.Ga;c++){var e=Us(a);var f=Xs(a);for(d=f+1;f<d;){d=f;At(a,c,1);var g=Xs(a);g>f?Vs(a,e):g<f&&(f=g,e=Us(a))}}if(0>b)for(c=a.Ga;0<=c;c--)for(e=Us(a),f=Xs(a),d=f+1;f<d;)d=f,At(a,c,-1),g=Xs(a),g>f?Vs(a,e):g<f&&(f=g,e=Us(a));a.normalize()}
function At(a,b,c){a.Kc=0;for(var d=a.network.vertexes.iterator;d.next();)d.value.component=-1;if(0<c)for(d.reset();d.next();){var e=d.value;e.column-a.nodeMinColumnSpace(e,!0)<=b&&(e.component=a.Kc)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.Kc);a.Kc++;for(d.reset();d.next();)b=d.value,-1===b.component&&(at(a,b,a.Kc,-1,!0,!0),a.Kc++);var f;b=[];for(f=0;f<a.Kc*a.Kc;f++)b[f]=!1;e=[];for(f=0;f<(a.xa+1)*(a.Ga+1);f++)e[f]=-1;for(d.reset();d.next();){f=
d.value;for(var g=f.layer,h=Math.max(0,f.column-a.nodeMinColumnSpace(f,!0)),k=Math.min(a.Ga,f.column+a.nodeMinColumnSpace(f,!1));h<=k;h++)e[g*(a.Ga+1)+h]=f.component}for(f=0;f<=a.xa;f++){if(0<c)for(g=0;g<a.Ga;g++)-1!==e[f*(a.Ga+1)+g]&&-1!==e[f*(a.Ga+1)+g+1]&&e[f*(a.Ga+1)+g]!==e[f*(a.Ga+1)+g+1]&&(b[e[f*(a.Ga+1)+g]*a.Kc+e[f*(a.Ga+1)+g+1]]=!0);if(0>c)for(g=a.Ga;0<g;g--)-1!==e[f*(a.Ga+1)+g]&&-1!==e[f*(a.Ga+1)+g-1]&&e[f*(a.Ga+1)+g]!==e[f*(a.Ga+1)+g-1]&&(b[e[f*(a.Ga+1)+g]*a.Kc+e[f*(a.Ga+1)+g-1]]=!0)}e=
[];for(f=0;f<a.Kc;f++)e[f]=!0;g=[];for(g.push(0);0!==g.length;)if(k=g[g.length-1],g.pop(),e[k])for(e[k]=!1,f=0;f<a.Kc;f++)b[k*a.Kc+f]&&g.splice(0,0,f);if(0<c)for(d.reset();d.next();)a=d.value,e[a.component]&&--a.column;if(0>c)for(d.reset();d.next();)c=d.value,e[c.component]&&(c.column+=1)}
Is.prototype.commitLayout=function(){if(this.setsPortSpots)for(var a=Ps(this,!0),b=Ps(this,!1),c=this.network.edges.iterator;c.next();){var d=c.value.link;null!==d&&(d.fromSpot=a,d.toSpot=b)}this.commitNodes();this.Uv();this.isRouting&&this.commitLinks()};function Ps(a,b){return 270===a.M?b?qd:td:90===a.M?b?td:qd:180===a.M?b?rd:sd:b?sd:rd}
Is.prototype.commitNodes=function(){this.Yd=[];this.Ad=[];this.zd=[];this.Na=[];for(var a=0;a<=this.xa;a++)this.Yd[a]=0,this.Ad[a]=0,this.zd[a]=0,this.Na[a]=0;for(a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;this.Yd[c]=Math.max(this.Yd[c],this.nodeMinLayerSpace(b,!0));this.Ad[c]=Math.max(this.Ad[c],this.nodeMinLayerSpace(b,!1))}b=0;c=this.Ae;for(var d=0;d<=this.xa;d++){var e=c;0>=this.Yd[d]+this.Ad[d]&&(e=0);0<d&&(b+=e/2);90===this.M||0===this.M?(b+=this.Ad[d],this.zd[d]=b,
b+=this.Yd[d]):(b+=this.Yd[d],this.zd[d]=b,b+=this.Ad[d]);d<this.xa&&(b+=e/2);this.Na[d]=b}c=b;b=this.arrangementOrigin;for(d=0;d<=this.xa;d++)270===this.M?this.zd[d]=b.y+this.zd[d]:90===this.M?(this.zd[d]=b.y+c-this.zd[d],this.Na[d]=c-this.Na[d]):180===this.M?this.zd[d]=b.x+this.zd[d]:(this.zd[d]=b.x+c-this.zd[d],this.Na[d]=c-this.Na[d]);a.reset();for(c=d=Infinity;a.next();){e=a.value;var f=e.layer,g=e.column|0;if(270===this.M||90===this.M){var h=b.x+this.ec*g;f=this.zd[f]}else h=this.zd[f],f=b.y+
this.ec*g;e.centerX=h;e.centerY=f;d=Math.min(e.x,d);c=Math.min(e.y,c)}d=b.x-d;b=b.y-c;this.Yc=new J(d,b);for(a.reset();a.next();)c=a.value,c.x+=d,c.y+=b,c.commit()};
Is.prototype.Uv=function(){for(var a=0,b=this.Ae,c=0;c<=this.xa;c++)a+=this.Yd[c],a+=this.Ad[c];a+=this.xa*b;b=[];c=this.ec*this.Ga;for(var d=this.maxLayer;0<=d;d--)270===this.M?0===d?b.push(new L(0,0,c,Math.abs(this.Na[0]))):b.push(new L(0,this.Na[d-1],c,Math.abs(this.Na[d-1]-this.Na[d]))):90===this.M?0===d?b.push(new L(0,this.Na[0],c,Math.abs(this.Na[0]-a))):b.push(new L(0,this.Na[d],c,Math.abs(this.Na[d-1]-this.Na[d]))):180===this.M?0===d?b.push(new L(0,0,Math.abs(this.Na[0]),c)):b.push(new L(this.Na[d-
1],0,Math.abs(this.Na[d-1]-this.Na[d]),c)):0===d?b.push(new L(this.Na[0],0,Math.abs(this.Na[0]-a),c)):b.push(new L(this.Na[d],0,Math.abs(this.Na[d-1]-this.Na[d]),c));this.commitLayers(b,this.Yc)};Is.prototype.commitLayers=function(){};
Is.prototype.commitLinks=function(){for(var a=this.network.edges.iterator,b;a.next();)b=a.value.link,null!==b&&(b.di(),b.yk(),b.Jf());for(a.reset();a.next();)b=a.value.link,null!==b&&b.Ij();for(a.reset();a.next();){var c=a.value;b=c.link;if(null!==b){b.di();var d=b,e=d.fromNode,f=d.toNode,g=d.fromPort,h=d.toPort;if(null!==e){var k=e.findVisibleNode();null!==k&&k!==e&&(e=k,g=k.port)}null!==f&&(k=f.findVisibleNode(),null!==k&&k!==f&&(f=k,h=k.port));var l=b.computeSpot(!0,g);k=b.computeSpot(!1,h);var m=
c.fromVertex,n=c.toVertex;if(c.valid){if(b.curve===rg&&4===b.pointsCount)if(m.column===n.column)c=b.getLinkPoint(e,g,l,!0,!1,f,h),g=b.getLinkPoint(f,h,k,!1,!1,e,g),c.o()||c.set(e.actualBounds.center),g.o()||g.set(f.actualBounds.center),b.yk(),b.Hf(c.x,c.y),b.Hf((2*c.x+g.x)/3,(2*c.y+g.y)/3),b.Hf((c.x+2*g.x)/3,(c.y+2*g.y)/3),b.Hf(g.x,g.y);else{var p=!1,r=!1;null!==g&&l===Gc&&(p=!0);null!==h&&k===Gc&&(r=!0);if(p||r){var q=b.i(0).x;c=b.i(0).y;m=b.i(3).x;d=b.i(3).y;p&&(90===this.M||270===this.M?(p=q,n=
(c+d)/2):(p=(q+m)/2,n=c),b.N(1,p,n),l=b.getLinkPoint(e,g,l,!0,!1,f,h),l.o()||l.set(e.actualBounds.center),b.N(0,l.x,l.y));r&&(90===this.M||270===this.M?(l=m,c=(c+d)/2):(l=(q+m)/2,c=d),b.N(2,l,c),e=b.getLinkPoint(f,h,k,!1,!1,e,g),e.o()||e.set(f.actualBounds.center),b.N(3,e.x,e.y))}}b.Jf()}else if(m.layer===n.layer)b.Jf();else{p=r=!1;q=b.firstPickIndex+1;if(b.isOrthogonal){p=!0;var u=b.pointsCount;4<u&&b.points.removeRange(2,u-3)}else if(b.curve===rg)r=!0,u=b.pointsCount,4<u&&b.points.removeRange(2,
u-3),4===u&&(q=2);else{u=b.pointsCount;var w=l===Gc,y=k===Gc;2<u&&w&&y?b.points.removeRange(1,u-2):3<u&&w&&!y?b.points.removeRange(1,u-3):3<u&&!w&&y?b.points.removeRange(2,u-2):4<u&&!w&&!y&&b.points.removeRange(2,u-3)}if(c.rev){for(;null!==n&&m!==n;){var z=u=null;for(w=n.sourceEdges.iterator;w.next()&&(y=w.value,y.link!==c.link||(u=y.fromVertex,z=y.toVertex,null!==u.node)););if(u!==m){w=b.i(q-1).x;y=b.i(q-1).y;var B=u.centerX;var D=u.centerY;if(p)180===this.M||0===this.M?q===b.firstPickIndex+1?(b.m(q++,
w,y),b.m(q++,w,D)):(null!==z?z.centerY:y)!==D&&(z=this.Na[u.layer-1]+this.Yc.x,b.m(q++,z,y),b.m(q++,z,D)):q===b.firstPickIndex+1?(b.m(q++,w,y),b.m(q++,B,y)):(null!==z?z.centerX:w)!==B&&(z=this.Na[u.layer-1]+this.Yc.y,b.m(q++,w,z),b.m(q++,B,z));else if(q===b.firstPickIndex+1){z=Math.max(10,this.Yd[n.layer]);var G=Math.max(10,this.Ad[n.layer]);if(r)180===this.M?B<=n.bounds.x?(n=n.bounds.x,b.m(q++,n-z,D),b.m(q++,n,D),b.m(q++,n+G,D)):(b.m(q++,B-z,D),b.m(q++,B,D),b.m(q++,B+G,D)):90===this.M?D>=n.bounds.bottom?
(n=n.bounds.y+n.bounds.height,b.m(q++,B,n+G),b.m(q++,B,n),b.m(q++,B,n-z)):(b.m(q++,B,D+G),b.m(q++,B,D),b.m(q++,B,D-z)):270===this.M?D<=n.bounds.y?(n=n.bounds.y,b.m(q++,B,n-z),b.m(q++,B,n),b.m(q++,B,n+G)):(b.m(q++,B,D-z),b.m(q++,B,D),b.m(q++,B,D+G)):0===this.M&&(B>=n.bounds.right?(n=n.bounds.x+n.bounds.width,b.m(q++,n+G,D),b.m(q++,n,D),b.m(q++,n-z,D)):(b.m(q++,B+G,D),b.m(q++,B,D),b.m(q++,B-z,D)));else{b.m(q++,w,y);var O=0;if(180===this.M||0===this.M){if(180===this.M?B>=n.bounds.right:B<=n.bounds.x)O=
(0===this.M?-z:G)/2;b.m(q++,w+O,D)}else{if(270===this.M?D>=n.bounds.bottom:D<=n.bounds.y)O=(90===this.M?-z:G)/2;b.m(q++,B,y+O)}b.m(q++,B,D)}}else z=Math.max(10,this.Yd[u.layer]),G=Math.max(10,this.Ad[u.layer]),180===this.M?(r&&b.m(q++,B-z,D),b.m(q++,B,D),r&&b.m(q++,B+G,D)):90===this.M?(r&&b.m(q++,B,D+G),b.m(q++,B,D),r&&b.m(q++,B,D-z)):270===this.M?(r&&b.m(q++,B,D-z),b.m(q++,B,D),r&&b.m(q++,B,D+G)):(r&&b.m(q++,B+G,D),b.m(q++,B,D),r&&b.m(q++,B-z,D))}n=u}if(null===h||l!==Gc||p)if(w=b.i(q-1).x,y=b.i(q-
1).y,B=b.i(q).x,D=b.i(q).y,p)n=this.Ad[m.layer],180===this.M||0===this.M?(p=y,p>=m.bounds.y&&p<=m.bounds.bottom&&(180===this.M?B>=m.bounds.x:B<=m.bounds.right)&&(n=m.centerX+(180===this.M?-n:n),p<m.bounds.y+m.bounds.height/2?p=m.bounds.y-this.ec/2:p=m.bounds.bottom+this.ec/2,b.m(q++,n,y),b.m(q++,n,p)),b.m(q++,B,p)):(p=w,p>=m.bounds.x&&p<=m.bounds.right&&(270===this.M?D>=m.bounds.y:D<=m.bounds.bottom)&&(n=m.centerY+(270===this.M?-n:n),p<m.bounds.x+m.bounds.width/2?p=m.bounds.x-this.ec/2:p=m.bounds.right+
this.ec/2,b.m(q++,w,n),b.m(q++,p,n)),b.m(q++,p,D)),b.m(q++,B,D);else if(r)z=Math.max(10,this.Yd[m.layer]),G=Math.max(10,this.Ad[m.layer]),180===this.M&&B>=m.bounds.x?(n=m.bounds.x+m.bounds.width,b.N(q-2,n,y),b.N(q-1,n+G,y)):90===this.M&&D<=m.bounds.bottom?(n=m.bounds.y,b.N(q-2,w,n),b.N(q-1,w,n-z)):270===this.M&&D>=m.bounds.y?(n=m.bounds.y+m.bounds.height,b.N(q-2,w,n),b.N(q-1,w,n+G)):0===this.M&&B<=m.bounds.right&&(n=m.bounds.x,b.N(q-2,n,y),b.N(q-1,n-z,y));else{z=Math.max(10,this.Yd[m.layer]);G=Math.max(10,
this.Ad[m.layer]);p=0;if(180===this.M||0===this.M){if(180===this.M?B<=m.bounds.x:B>=m.bounds.right)p=(0===this.M?G:-z)/2;b.m(q++,B+p,y)}else{if(270===this.M?D<=m.bounds.y:D>=m.bounds.bottom)p=(90===this.M?G:-z)/2;b.m(q++,w,D+p)}b.m(q++,B,D)}}else{for(;null!==m&&m!==n;){z=u=null;for(m=m.destinationEdges.iterator;m.next()&&(w=m.value,w.link!==c.link||(u=w.toVertex,z=w.fromVertex,null!==z.node&&(z=null),null!==u.node)););u!==n&&(w=b.i(q-1).x,y=b.i(q-1).y,B=u.centerX,D=u.centerY,p?180===this.M||0===this.M?
(null!==z?z.centerY:y)!==D&&(z=this.Na[u.layer]+this.Yc.x,q===b.firstPickIndex+1&&(z=0===this.M?Math.max(z,w):Math.min(z,w)),b.m(q++,z,y),b.m(q++,z,D)):(null!==z?z.centerX:w)!==B&&(z=this.Na[u.layer]+this.Yc.y,q===b.firstPickIndex+1&&(z=90===this.M?Math.max(z,y):Math.min(z,y)),b.m(q++,w,z),b.m(q++,B,z)):(z=Math.max(10,this.Yd[u.layer]),G=Math.max(10,this.Ad[u.layer]),180===this.M?(b.m(q++,B+G,D),r&&b.m(q++,B,D),b.m(q++,B-z,D)):90===this.M?(b.m(q++,B,D-z),r&&b.m(q++,B,D),b.m(q++,B,D+G)):270===this.M?
(b.m(q++,B,D+G),r&&b.m(q++,B,D),b.m(q++,B,D-z)):(b.m(q++,B-z,D),r&&b.m(q++,B,D),b.m(q++,B+G,D))));m=u}p&&(w=b.i(q-1).x,y=b.i(q-1).y,B=b.i(q).x,D=b.i(q).y,180===this.M||0===this.M?y!==D&&(z=0===this.M?Math.min(Math.max((B+w)/2,this.Na[n.layer]+this.Yc.x),B):Math.max(Math.min((B+w)/2,this.Na[n.layer]+this.Yc.x),B),b.m(q++,z,y),b.m(q++,z,D)):w!==B&&(z=90===this.M?Math.min(Math.max((D+y)/2,this.Na[n.layer]+this.Yc.y),D):Math.max(Math.min((D+y)/2,this.Na[n.layer]+this.Yc.y),D),b.m(q++,w,z),b.m(q++,B,z)))}null!==
d&&r&&(null!==g&&(l===Gc&&(l=b.i(0),d=b.i(2),l.A(d)||b.N(1,(l.x+d.x)/2,(l.y+d.y)/2)),l=b.getLinkPoint(e,g,Gc,!0,!1,f,h),l.o()||l.set(e.actualBounds.center),b.N(0,l.x,l.y)),null!==h&&(k===Gc&&(k=b.i(b.pointsCount-1),l=b.i(b.pointsCount-3),k.A(l)||b.N(b.pointsCount-2,(k.x+l.x)/2,(k.y+l.y)/2)),e=b.getLinkPoint(f,h,Gc,!1,!1,e,g),e.o()||e.set(f.actualBounds.center),b.N(b.pointsCount-1,e.x,e.y)));b.Jf();c.commit()}}}this.avoidOrthogonalOverlaps()};
Is.prototype.avoidOrthogonalOverlaps=function(){if(!(0>=this.linkSpacing)){for(var a=new H,b=this.network.edges.iterator;b.next();){var c=b.value.link;null!==c&&c.isOrthogonal&&!a.contains(c)&&a.add(c)}if(0<a.count)if(90===this.M||270===this.M){b=0;c=[];for(a=a.iterator;a.next();){var d=a.value;if(null!==d&&d.isOrthogonal)for(var e=2;e<d.pointsCount-3;e++){var f=d.i(e);var g=d.i(e+1);if(this.C(f.y,g.y)&&!this.C(f.x,g.x)){var h=new Bt;h.layer=Math.floor(f.y/2);var k=d.i(0),l=d.i(d.pointsCount-1);h.first=
k.x*k.x+k.y;h.cc=l.x*l.x+l.y;h.gd=Math.min(f.x,g.x);h.Ac=Math.max(f.x,g.x);h.index=e;h.link=d;if(e+2<d.pointsCount){k=d.i(e-1);l=d.i(e+2);var m=0;k.y<f.y?m=l.y<f.y?3:f.x<g.x?2:1:k.y>f.y&&(m=l.y>f.y?0:g.x<f.x?2:1);h.l=m}c.push(h)}}}if(1<c.length)for(c.sort(this.dz),a=0;a<c.length;){f=c[a].layer;for(d=a+1;d<c.length&&c[d].layer===f;)d++;if(1<d-a)for(f=a;f<d;){g=c[f].Ac;for(e=a+1;e<d&&c[e].gd<g;)g=Math.max(g,c[e].Ac),e++;g=e-f;if(1<g){this.Fj(c,this.uu,f,f+g);m=1;h=c[f].cc;for(k=f;k<e;k++)l=c[k],l.cc!==
h&&(m++,h=l.cc);this.Fj(c,this.cz,f,f+g);var n=1;h=c[f].first;for(k=f;k<e;k++)l=c[k],l.first!==h&&(n++,h=l.first);k=!0;l=n;m<n?(k=!1,l=m,h=c[f].cc,this.Fj(c,this.uu,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++){var p=c[n];(k?p.first:p.cc)!==h&&(m++,h=k?p.first:p.cc);var r=p.link;f=r.i(p.index);g=r.i(p.index+1);var q=this.linkSpacing*(m-(l-1)/2);if(!r.isAvoiding||Ct(f.x,f.y+q,g.x,g.y+q))b++,r.di(),r.N(p.index,f.x,f.y+q),r.N(p.index+1,g.x,g.y+q),r.Jf()}}f=e}a=d}}else{b=0;c=[];for(a=a.iterator;a.next();)if(d=
a.value,null!==d&&d.isOrthogonal)for(e=2;e<d.pointsCount-3;e++)f=d.i(e),g=d.i(e+1),this.C(f.x,g.x)&&!this.C(f.y,g.y)&&(h=new Bt,h.layer=Math.floor(f.x/2),k=d.i(0),l=d.i(d.pointsCount-1),h.first=k.x+k.y*k.y,h.cc=l.x+l.y*l.y,h.gd=Math.min(f.y,g.y),h.Ac=Math.max(f.y,g.y),h.index=e,h.link=d,e+2<d.pointsCount&&(k=d.i(e-1),l=d.i(e+2),m=0,k.x<f.x?m=l.x<f.x?3:f.y<g.y?2:1:k.x>f.x&&(m=l.x>f.x?0:g.y<f.y?2:1),h.l=m),c.push(h));if(1<c.length)for(c.sort(this.dz),a=0;a<c.length;){f=c[a].layer;for(d=a+1;d<c.length&&
c[d].layer===f;)d++;if(1<d-a)for(f=a;f<d;){g=c[f].Ac;for(e=a+1;e<d&&c[e].gd<g;)g=Math.max(g,c[e].Ac),e++;g=e-f;if(1<g){this.Fj(c,this.uu,f,f+g);m=1;h=c[f].cc;for(k=f;k<e;k++)l=c[k],l.cc!==h&&(m++,h=l.cc);this.Fj(c,this.cz,f,f+g);n=1;h=c[f].first;for(k=f;k<e;k++)l=c[k],l.first!==h&&(n++,h=l.first);k=!0;l=n;m<n?(k=!1,l=m,h=c[f].cc,this.Fj(c,this.uu,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++)if(p=c[n],(k?p.first:p.cc)!==h&&(m++,h=k?p.first:p.cc),r=p.link,f=r.i(p.index),g=r.i(p.index+1),q=this.linkSpacing*
(m-(l-1)/2),!r.isAvoiding||Ct(f.x+q,f.y,g.x+q,g.y))b++,r.di(),r.N(p.index,f.x+q,f.y),r.N(p.index+1,g.x+q,g.y),r.Jf()}f=e}a=d}}}};t=Is.prototype;t.dz=function(a,b){return a instanceof Bt&&b instanceof Bt&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.gd<b.gd?-1:a.gd>b.gd?1:a.Ac<b.Ac?-1:a.Ac>b.Ac?1:0:0};t.cz=function(a,b){return a instanceof Bt&&b instanceof Bt&&a!==b?a.first<b.first?-1:a.first>b.first||a.l<b.l?1:a.l>b.l||a.gd<b.gd?-1:a.gd>b.gd?1:a.Ac<b.Ac?-1:a.Ac>b.Ac?1:0:0};
t.uu=function(a,b){return a instanceof Bt&&b instanceof Bt&&a!==b?a.cc<b.cc?-1:a.cc>b.cc||a.l<b.l?1:a.l>b.l||a.gd<b.gd?-1:a.gd>b.gd?1:a.Ac<b.Ac?-1:a.Ac>b.Ac?1:0:0};t.C=function(a,b){F&&(C(a,Is,"isApprox:a"),C(b,Is,"isApprox:b"));a-=b;return-1<a&&1>a};
t.Fj=function(a,b,c,d){var e=a.length,f=d-c;if(!(1>=f))if((0>c||c>=e-1)&&v("not in range 0 <= from < length: "+c),2===f)d=a[c],e=a[c+1],0<b(d,e)&&(a[c]=e,a[c+1]=d);else if(0===c)if(d>=e)a.sort(b);else for(c=a.slice(0,d),c.sort(b),b=0;b<d;b++)a[b]=c[b];else if(d>=e)for(d=a.slice(c),d.sort(b),b=c;b<e;b++)a[b]=d[b-c];else for(e=a.slice(c,d),e.sort(b),b=c;b<d;b++)a[b]=e[b-c]};
function Ct(a,b,c,d){F&&(C(a,Is,"isUnoccupied2:px"),C(b,Is,"isUnoccupied2:py"),C(c,Is,"isUnoccupied2:qx"),C(d,Is,"isUnoccupied2:qy"));return!0}function Rs(a,b){var c=a.Eb[b];if(c>=a.Ee.length){var d=[];for(var e=0;e<a.Ee.length;e++)d[e]=a.Ee[e];a.Ee=d}void 0===a.Ee[c]||null===a.Ee[c]?d=[]:(d=a.Ee[c],a.Ee[c]=null);a=a.pp[b];for(b=0;b<a.length;b++)c=a[b],d[c.index]=c;return d}function Ss(a,b,c){a.Ee[a.Eb[b]]=c}
ma.Object.defineProperties(Is.prototype,{layerSpacing:{configurable:!0,get:function(){return this.Ae},set:function(a){this.Ae!==a&&(A(a,"number",Is,"layerSpacing"),0<=a&&(this.Ae=a,this.D()))}},columnSpacing:{configurable:!0,get:function(){return this.ec},set:function(a){this.ec!==a&&(A(a,"number",Is,"columnSpacing"),0<a&&(this.ec=a,this.D()))}},direction:{configurable:!0,get:function(){return this.M},set:function(a){this.M!==a&&(A(a,"number",Is,"direction"),
0===a||90===a||180===a||270===a?(this.M=a,this.D()):v("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},cycleRemoveOption:{configurable:!0,get:function(){return this.ol},set:function(a){this.ol!==a&&(hb(a,Is,Is,"cycleRemoveOption"),a===bt||a===Js||a===Os)&&(this.ol=a,this.D())}},layeringOption:{configurable:!0,get:function(){return this.Tl},set:function(a){this.Tl!==a&&(hb(a,Is,Is,"layeringOption"),a===Ks||a===gt||a===it)&&(this.Tl=a,this.D())}},initializeOption:{configurable:!0,
enumerable:!0,get:function(){return this.Il},set:function(a){this.Il!==a&&(hb(a,Is,Is,"initializeOption"),a===Ls||a===ot||a===mt)&&(this.Il=a,this.D())}},iterations:{configurable:!0,get:function(){return this.$j},set:function(a){this.$j!==a&&(C(a,Ns,"iterations"),0<=a&&(this.$j=a,this.D()))}},aggressiveOption:{configurable:!0,get:function(){return this.dl},set:function(a){this.dl!==a&&(hb(a,Is,Is,"aggressiveOption"),a===st||a===Ms||a===tt)&&(this.dl=a,this.D())}},packOption:{configurable:!0,
enumerable:!0,get:function(){return this.zg},set:function(a){this.zg!==a&&(A(a,"number",Is,"packOption"),0<=a&&8>a&&(this.zg=a,this.D()))}},setsPortSpots:{configurable:!0,get:function(){return this.vf},set:function(a){this.vf!==a&&(A(a,"boolean",Is,"setsPortSpots"),this.vf=a,this.D())}},linkSpacing:{configurable:!0,get:function(){return this.Vo},set:function(a){this.Vo!==a&&(A(a,"number",Is,"linkSpacing"),0<=a&&(this.Vo=a,this.D()))}},maxLayer:{configurable:!0,
get:function(){return this.xa}},maxIndex:{configurable:!0,get:function(){return this.Ti}},maxColumn:{configurable:!0,get:function(){return this.Ga}},minIndexLayer:{configurable:!0,get:function(){return this.xh}},maxIndexLayer:{configurable:!0,get:function(){return this.tc}}});
var Js=new E(Is,"CycleDepthFirst",0),bt=new E(Is,"CycleGreedy",1),Os=new E(Is,"CycleFromLayers",2),Ks=new E(Is,"LayerOptimalLinkLength",0),gt=new E(Is,"LayerLongestPathSink",1),it=new E(Is,"LayerLongestPathSource",2),Ls=new E(Is,"InitDepthFirstOut",0),ot=new E(Is,"InitDepthFirstIn",1),mt=new E(Is,"InitNaive",2),st=new E(Is,"AggressiveNone",0),Ms=new E(Is,"AggressiveLess",1),tt=new E(Is,"AggressiveMore",2);Is.className="LayeredDigraphLayout";Is.CycleDepthFirst=Js;Is.CycleGreedy=bt;
Is.CycleFromLayers=Os;Is.LayerOptimalLinkLength=Ks;Is.LayerLongestPathSink=gt;Is.LayerLongestPathSource=it;Is.InitDepthFirstOut=Ls;Is.InitDepthFirstIn=ot;Is.InitNaive=mt;Is.AggressiveNone=st;Is.AggressiveLess=Ms;Is.AggressiveMore=tt;Is.PackNone=0;Is.PackExpand=1;Is.PackStraighten=2;Is.PackMedian=4;Is.PackAll=7;function Bt(){this.index=this.Ac=this.gd=this.cc=this.first=this.layer=0;this.link=null;this.l=0}Bt.className="SegInfo";function Ns(a){iq.call(this,a)}la(Ns,iq);Ns.prototype.createVertex=function(){return new Dt(this)};
Ns.prototype.createEdge=function(){return new Et(this)};Ns.className="LayeredDigraphNetwork";function Dt(a){wq.call(this,a);this.Va=this.dh=this.Pi=-1;this.L=NaN;this.W=null;this.valid=!1;this.finish=this.Og=NaN;this.If=0;this.Sk=this.Tk=null}la(Dt,wq);
Dt.prototype.serializeVertexProperties=function(a,b){wq.prototype.serializeVertexProperties.call(this,a,b);a.layer=this.layer;a.column=this.column;a.index=this.index;a.component=this.component;a.near=this.near?pb(this.near):null;a.valid=this.valid;a.Og=this.Og;a.finish=this.finish;a.If=this.If;a.Tk=this.Tk;a.Sk=this.Sk};
Dt.prototype.Nq=function(a,b,c,d){wq.prototype.Nq.call(this,a,b,c,d);this.layer=a.layer;this.column=a.column;this.index=a.index;this.component=a.component;if(b=b.get(a.near))this.near=b;this.valid=a.valid;this.Og=a.Og;this.finish=a.finish;this.If=a.If;this.Tk=a.Tk;this.Sk=a.Sk};
ma.Object.defineProperties(Dt.prototype,{layer:{configurable:!0,get:function(){return this.Pi},set:function(a){this.Pi!==a&&(A(a,"number",Dt,"layer"),this.Pi=a)}},column:{configurable:!0,get:function(){return this.dh},set:function(a){this.dh!==a&&(A(a,"number",Dt,"column"),this.dh=a)}},index:{configurable:!0,get:function(){return this.Va},set:function(a){this.Va!==a&&(A(a,"number",Dt,"index"),this.Va=a)}},component:{configurable:!0,get:function(){return this.L},
set:function(a){this.L!==a&&(A(a,"number",Dt,"component"),this.L=a)}},near:{configurable:!0,get:function(){return this.W},set:function(a){this.W!==a&&(F&&null!==a&&x(a,Dt,Dt,"near"),this.W=a)}}});Dt.className="LayeredDigraphVertex";function Et(a){xq.call(this,a);this.l=this.Pa=this.jb=!1;this.Oa=this.L=NaN;this.W=this.w=0}la(Et,xq);
Et.prototype.serializeEdgeProperties=function(a,b){xq.prototype.serializeEdgeProperties.call(this,a,b);a.valid=this.valid;a.rev=this.rev;a.forest=this.forest;a.portFromPos=this.portFromPos;a.portToPos=this.portToPos;a.portFromColOffset=this.portFromColOffset;a.portToColOffset=this.portToColOffset};
Et.prototype.deserializeEdgeProperties=function(a,b,c,d){xq.prototype.deserializeEdgeProperties.call(this,a,b,c,d);this.valid=a.valid;this.rev=a.rev;this.forest=a.forest;this.portFromPos=a.portFromPos;this.portToPos=a.portToPos;this.portFromColOffset=a.portFromColOffset;this.portToColOffset=a.portToColOffset};
ma.Object.defineProperties(Et.prototype,{valid:{configurable:!0,get:function(){return this.jb},set:function(a){this.jb!==a&&(A(a,"boolean",Et,"valid"),this.jb=a)}},rev:{configurable:!0,get:function(){return this.Pa},set:function(a){this.Pa!==a&&(A(a,"boolean",Et,"rev"),this.Pa=a)}},forest:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(A(a,"boolean",Et,"forest"),this.l=a)}},portFromPos:{configurable:!0,get:function(){return this.L},
set:function(a){this.L!==a&&(A(a,"number",Et,"portFromPos"),this.L=a)}},portToPos:{configurable:!0,get:function(){return this.Oa},set:function(a){this.Oa!==a&&(A(a,"number",Et,"portToPos"),this.Oa=a)}},portFromColOffset:{configurable:!0,get:function(){return this.w},set:function(a){this.w!==a&&(A(a,"number",Et,"portFromColOffset"),this.w=a)}},portToColOffset:{configurable:!0,get:function(){return this.W},set:function(a){this.W!==a&&(A(a,"number",Et,"portToColOffset"),
this.W=a)}}});Et.className="LayeredDigraphEdge";function Z(){0<arguments.length&&za(Z);Mi.call(this);this.Pb=new I;this.Ep=Ft;this.md=Gt;this.zq=Ht;this.Is=It;this.Ax=[];this.ld=!0;this.Kb=Jt;this.Od=(new Hb(10,10)).freeze();var a=new Kt(this);this.Y=new Lt(a);this.Z=new Lt(a);this.Hv=[]}la(Z,Mi);
Z.prototype.cloneProtected=function(a){Mi.prototype.cloneProtected.call(this,a);a.Ep=this.Ep;a.zq=this.zq;a.Is=this.Is;a.ld=this.ld;a.Kb=this.Kb;a.Od.assign(this.Od);a.Y.copyInheritedPropertiesFrom(this.Y);a.Z.copyInheritedPropertiesFrom(this.Z)};
Z.prototype.nb=function(a){a.classType===Z?0===a.name.indexOf("Alignment")?this.alignment=a:0===a.name.indexOf("Arrangement")?this.arrangement=a:0===a.name.indexOf("Compaction")?this.compaction=a:0===a.name.indexOf("Path")?this.path=a:0===a.name.indexOf("Sorting")?this.sorting=a:0===a.name.indexOf("Style")?this.treeStyle=a:v("Unknown enum value: "+a):Mi.prototype.nb.call(this,a)};Z.prototype.createNetwork=function(){return new Kt(this)};
Z.prototype.makeNetwork=function(a){function b(a){if(a instanceof U)return!a.isLinkLabel&&"Comment"!==a.category;if(a instanceof R){var b=a.fromNode;if(null===b||b.isLinkLabel||"Comment"===b.category)return!1;a=a.toNode;return null===a||a.isLinkLabel||"Comment"===a.category?!1:!0}return!1}var c=this.createNetwork();a instanceof Q?(c.Mg(a.nodes,!0,b),c.Mg(a.links,!0,b)):a instanceof Hf?c.Mg(a.memberParts,!1,b):c.Mg(a.iterator,!1,b);return c};
Z.prototype.doLayout=function(a){F&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));this.arrangement!==Mt&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var b=this.diagram;null===b&&a instanceof Q&&(b=a);this.path===Ft&&null!==b?this.md=b.isTreePathToChildren?Gt:Nt:this.md=this.path===Ft?Gt:this.path;if(0<this.network.vertexes.count){this.network.Mq();
for(a=this.network.vertexes.iterator;a.next();)b=a.value,b.initialized=!1,b.level=0,b.parent=null,b.children=[];if(0<this.Pb.count){a=new I;for(b=this.Pb.iterator;b.next();){var c=b.value;c instanceof U?(c=this.network.vj(c),null!==c&&a.add(c)):c instanceof Lt&&a.add(c)}this.Pb=a}0===this.Pb.count&&this.findRoots();for(a=this.Pb.copy().iterator;a.next();)b=a.value,b.initialized||(b.initialized=!0,Ot(this,b));b=this.network.vertexes;for(a=null;a=Pt(b),0<a.count;)b=Qt(this,a),null!==b&&this.Pb.add(b),
b.initialized=!0,Ot(this,b),b=a;for(a=this.Pb.iterator;a.next();)b=a.value,b instanceof Lt&&Rt(this,b);for(a=this.Pb.iterator;a.next();)b=a.value,b instanceof Lt&&St(this,b);for(a=this.Pb.iterator;a.next();)b=a.value,b instanceof Lt&&Tt(this,b);this.Sv();if(this.layerStyle===Ut){a=[];for(b=this.network.vertexes.iterator;b.next();){c=b.value;var d=c.parent;null===d&&(d=c);d=0===d.angle||180===d.angle;var e=a[c.level];void 0===e&&(e=0);a[c.level]=Math.max(e,d?c.width:c.height)}for(b=0;b<a.length;b++)void 0===
a[b]&&(a[b]=0);this.Ax=a;for(b=this.network.vertexes.iterator;b.next();)c=b.value,d=c.parent,null===d&&(d=c),0===d.angle||180===d.angle?(180===d.angle&&(c.focusX+=a[c.level]-c.width),c.width=a[c.level]):(270===d.angle&&(c.focusY+=a[c.level]-c.height),c.height=a[c.level])}else if(this.layerStyle===Vt)for(a=this.network.vertexes.iterator;a.next();){b=a.value;c=0===b.angle||180===b.angle;d=-1;for(e=0;e<b.children.length;e++){var f=b.children[e];d=Math.max(d,c?f.width:f.height)}if(0<=d)for(e=0;e<b.children.length;e++)f=
b.children[e],c?(180===b.angle&&(f.focusX+=d-f.width),f.width=d):(270===b.angle&&(f.focusY+=d-f.height),f.height=d)}for(a=this.Pb.iterator;a.next();)b=a.value,b instanceof Lt&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.Pb=new I;this.isValidLayout=!0};function Pt(a){var b=new I;for(a=a.iterator;a.next();){var c=a.value;c.initialized||b.add(c)}return b}
Z.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.iterator;b.next();){var c=b.value;switch(this.md){case Gt:0===c.sourceEdges.count&&this.Pb.add(c);break;case Nt:0===c.destinationEdges.count&&this.Pb.add(c);break;default:v("Unhandled path value "+this.md.toString())}}0===this.Pb.count&&(a=Qt(this,a),null!==a&&this.Pb.add(a))};
function Qt(a,b){var c=999999,d=null;for(b=b.iterator;b.next();){var e=b.value;switch(a.md){case Gt:e.sourceEdges.count<c&&(c=e.sourceEdges.count,d=e);break;case Nt:e.destinationEdges.count<c&&(c=e.destinationEdges.count,d=e);break;default:v("Unhandled path value "+a.md.toString())}}return d}
function Ot(a,b){if(null!==b){F&&x(b,Lt,Z,"walkTree:v");switch(a.md){case Gt:if(0<b.destinationEdges.count){for(var c=new H,d=b.destinationVertexes;d.next();){var e=d.value;Wt(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.ta())}break;case Nt:if(0<b.sourceEdges.count){c=new H;for(d=b.sourceVertexes;d.next();)e=d.value,Wt(a,b,e)&&c.add(e);0<c.count&&(b.children=c.ta())}break;default:v("Unhandled path value"+a.md.toString())}c=b.children;d=c.length;for(e=0;e<d;e++){var f=c[e];f.initialized=!0;f.level=b.level+
1;f.parent=b;a.Pb.remove(f)}for(b=0;b<d;b++)Ot(a,c[b])}}function Wt(a,b,c){F&&x(b,Lt,Z,"walkOK:v");F&&x(c,Lt,Z,"walkOK:c");if(c.initialized){if(null===b)var d=!1;else{F&&x(c,Lt,Z,"isAncestor:a");F&&x(b,Lt,Z,"isAncestor:b");for(d=b.parent;null!==d&&d!==c;)d=d.parent;d=d===c}if(d||c.level>b.level)return!1;a.removeChild(c.parent,c)}return!0}
Z.prototype.removeChild=function(a,b){if(null!==a&&null!==b){F&&x(a,Lt,Z,"removeChild:p");F&&x(b,Lt,Z,"removeChild:c");for(var c=a.children,d=0,e=0;e<c.length;e++)c[e]===b&&d++;if(0<d){d=Array(c.length-d);for(var f=e=0;f<c.length;f++)c[f]!==b&&(d[e++]=c[f]);a.children=d}}};
function Rt(a,b){if(null!==b){F&&x(b,Lt,Z,"initializeTree:v");a.initializeTreeVertexValues(b);b.alignment===Xt&&a.sortTreeVertexChildren(b);for(var c=0,d=b.childrenCount,e=0,f=b.children,g=f.length,h=0;h<g;h++){var k=f[h];Rt(a,k);c+=k.descendantCount+1;d=Math.max(d,k.maxChildrenCount);e=Math.max(e,k.maxGenerationCount)}b.descendantCount=c;b.maxChildrenCount=d;b.maxGenerationCount=0<d?e+1:0}}
function Yt(a,b){F&&x(b,Lt,Z,"mom:v");switch(a.zq){default:case Ht:return null!==b.parent?b.parent:a.Y;case Zt:return null===b.parent?a.Y:null===b.parent.parent?a.Z:b.parent;case $t:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.Z:a.Y;case au:var c=!0;if(0===b.childrenCount)c=!1;else for(var d=b.children,e=d.length,f=0;f<e;f++)if(0<d[f].childrenCount){c=!1;break}return c&&null!==b.parent?a.Z:null!==b.parent?b.parent:a.Y}}
Z.prototype.initializeTreeVertexValues=function(a){F&&x(a,Lt,Z,"initializeTreeVertexValues:v");var b=Yt(this,a);a.copyInheritedPropertiesFrom(b);if(null!==a.parent&&a.parent.alignment===Xt){b=a.angle;for(var c=a.parent.children,d=0;d<c.length&&a!==c[d];)d++;0===d%2?d!==c.length-1&&(b=90===b?180:180===b?270:270===b?180:270):b=90===b?0:180===b?90:270===b?0:90;a.angle=b}a.initialized=!0};
function St(a,b){if(null!==b){F&&x(b,Lt,Z,"assignTree:v");a.assignTreeVertexValues(b);b=b.children;for(var c=b.length,d=0;d<c;d++)St(a,b[d])}}Z.prototype.assignTreeVertexValues=function(){};function Tt(a,b){if(null!==b){F&&x(b,Lt,Z,"sortTree:v");b.alignment!==Xt&&a.sortTreeVertexChildren(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Tt(a,b[d])}}
Z.prototype.sortTreeVertexChildren=function(a){F&&x(a,Lt,Z,"sortTreeVertexChildren:v");switch(a.sorting){case bu:break;case cu:a.children.reverse();break;case du:a.children.sort(a.comparer);break;case eu:a.children.sort(a.comparer);a.children.reverse();break;default:v("Unhandled sorting value "+a.sorting.toString())}};Z.prototype.Sv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
Z.prototype.addComments=function(a){F&&x(a,Lt,Z,"addComments:v");var b=a.angle,c=a.parent,d=0;var e=!1;null!==c&&(d=c.angle,e=c.alignment,e=fu(e));b=90===b||270===b;d=90===d||270===d;c=0===a.childrenCount;var f=0,g=0,h=0,k=a.commentSpacing;if(null!==a.node)for(var l=a.node.fw();l.next();){var m=l.value;"Comment"===m.category&&m.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(m),m.Ya(),m=m.measuredBounds,b&&!c||!e&&!d&&c||e&&d&&c?(f=Math.max(f,m.width),g+=m.height+Math.abs(h)):(f+=
m.width+Math.abs(h),g=Math.max(g,m.height)),h=k)}null!==a.comments&&(b&&!c||!e&&!d&&c||e&&d&&c?(f+=Math.abs(a.commentMargin),g=Math.max(0,g-a.height)):(g+=Math.abs(a.commentMargin),f=Math.max(0,f-a.width)),e=L.allocAt(0,0,a.bounds.width+f,a.bounds.height+g),a.bounds=e,L.free(e))};function fu(a){return a===gu||a===Xt||a===hu||a===iu}function ju(a){return a===gu||a===Xt}
function ku(a){F&&x(a,Lt,Z,"isLeftSideBus:v");var b=a.parent;if(null!==b){var c=b.alignment;if(fu(c)){if(ju(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===hu)return!0}}return!1}
Z.prototype.layoutComments=function(a){F&&x(a,Lt,Z,"layoutComments:v");if(null!==a.comments){var b=a.node.measuredBounds,c=a.parent,d=a.angle,e=0;var f=!1;null!==c&&(e=c.angle,f=c.alignment,f=fu(f));d=90===d||270===d;c=90===e||270===e;for(var g=0===a.childrenCount,h=ku(a),k=0,l=a.comments,m=l.length,n=J.alloc(),p=0;p<m;p++){var r=l[p],q=r.measuredBounds;if(d&&!g||!f&&!c&&g||f&&c&&g){if(135<e&&!f||c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x-a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.Hd();r.next();){var u=
r.value;u.fromSpot=rd;u.toSpot=sd}else for(n.h(a.bounds.x+2*a.focus.x-a.commentMargin,a.bounds.y+k),r.move(n),r=r.Hd();r.next();)u=r.value,u.fromSpot=sd,u.toSpot=rd;else if(0<=a.commentMargin)for(n.h(a.bounds.x+2*a.focus.x+a.commentMargin,a.bounds.y+k),r.move(n),r=r.Hd();r.next();)u=r.value,u.fromSpot=sd,u.toSpot=rd;else for(n.h(a.bounds.x+a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.Hd();r.next();)u=r.value,u.fromSpot=rd,u.toSpot=sd;k=0<=a.commentSpacing?k+(q.height+a.commentSpacing):k+(a.commentSpacing-
q.height)}else{if(135<e&&!f||!c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y-a.commentMargin-q.height),r.move(n),r=r.Hd();r.next();)u=r.value,u.fromSpot=qd,u.toSpot=td;else for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y-a.commentMargin),r.move(n),r=r.Hd();r.next();)u=r.value,u.fromSpot=td,u.toSpot=qd;else if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y+a.commentMargin),r.move(n),r=r.Hd();r.next();)u=r.value,u.fromSpot=td,u.toSpot=qd;else for(n.h(a.bounds.x+k,a.bounds.y+
a.commentMargin-q.height),r.move(n),r=r.Hd();r.next();)u=r.value,u.fromSpot=qd,u.toSpot=td;k=0<=a.commentSpacing?k+(q.width+a.commentSpacing):k+(a.commentSpacing-q.width)}}J.free(n);b=k-a.commentSpacing-(d?b.height:b.width);if(this.md===Gt)for(a=a.destinationEdges;a.next();)e=a.value.link,null===e||e.isAvoiding||(e.fromEndSegmentLength=0<b?b:NaN);else for(a=a.sourceEdges;a.next();)e=a.value.link,null===e||e.isAvoiding||(e.toEndSegmentLength=0<b?b:NaN)}};
Z.prototype.layoutTree=function(a){if(null!==a){F&&x(a,Lt,Z,"layoutTree:v");for(var b=a.children,c=b.length,d=0;d<c;d++)this.layoutTree(b[d]);switch(a.compaction){case lu:mu(this,a);break;case nu:if(a.alignment===Xt)mu(this,a);else if(F&&x(a,Lt,Z,"layoutTreeBlock:v"),0===a.childrenCount)d=a.parent,c=!1,b=0,null!==d&&(b=d.angle,c=d.alignment,c=fu(c)),d=ku(a),a.V.h(0,0),a.Ba.h(a.width,a.height),null===a.parent||null===a.comments||(180!==b&&270!==b||c)&&!d?a.ja.h(0,0):180===b&&!c||(90===b||270===b)&&
d?a.ja.h(a.width-2*a.focus.x,0):a.ja.h(0,a.height-2*a.focus.y),a.cr=null,a.rr=null;else{var e=ou(a);b=90===e||270===e;var f=0,g=a.children,h=g.length;for(c=0;c<h;c++)d=g[c],f=Math.max(f,b?d.Ba.width:d.Ba.height);var k=a.alignment;d=k===pu;var l=k===uu,m=fu(k),n=Math.max(0,a.breadthLimit);c=vu(a);var p=a.nodeSpacing,r=wu(a),q=a.rowSpacing,u=0;if(d||l||a.en||a.fn&&1===a.maxGenerationCount)u=Math.max(0,a.rowIndent);d=a.width;var w=a.height,y=0,z=0,B=0,D=null,G=null,O=0,T=0,P=0,ba=0,Y=0,oa=0,Ea=0,X=0;
m&&!ju(k)&&135<e&&g.reverse();if(ju(k))if(1<h)for(var Ma=0;Ma<h;Ma++)0===Ma%2&&Ma!==h-1&&(X=Math.max(X,b?g[Ma].Ba.width:g[Ma].Ba.height));else 1===h&&(X=b?g[0].Ba.width:g[0].Ba.height);if(m){switch(k){case gu:z=135>e?xu(a,g,X,y,z):yu(a,g,X,y,z);X=z.x;y=z.width;z=z.height;break;case hu:for(D=0;D<h;D++)G=g[D],n=G.Ba,B=0===oa?0:q,b?(G.V.h(f-n.width,ba+B),y=Math.max(y,n.width),z=Math.max(z,ba+B+n.height),ba+=B+n.height):(G.V.h(P+B,f-n.height),y=Math.max(y,P+B+n.width),z=Math.max(z,n.height),P+=B+n.width),
oa++;break;case iu:for(D=0;D<h;D++)G=g[D],f=G.Ba,n=0===oa?0:q,b?(G.V.h(p/2+a.focus.x,ba+n),y=Math.max(y,f.width),z=Math.max(z,ba+n+f.height),ba+=n+f.height):(G.V.h(P+n,p/2+a.focus.y),y=Math.max(y,P+n+f.width),z=Math.max(z,f.height),P+=n+f.width),oa++}D=zu(this,2);G=zu(this,2);b?(D[0].h(0,0),D[1].h(0,z),G[0].h(y,0)):(D[0].h(0,0),D[1].h(y,0),G[0].h(0,z));G[1].h(y,z)}else for(Ma=0;Ma<h;Ma++){var Wa=g[Ma],yb=Wa.Ba;if(b){0<n&&0<oa&&P+p+yb.width>n&&(P<f&&Au(a,k,f-P,0,Ea,Ma-1),Y++,oa=0,Ea=Ma,B=z,P=0,ba=
135<e?-z-q:z+q);Bu(this,Wa,0,ba);var Va=0;if(0===oa){if(D=Wa.cr,G=Wa.rr,O=yb.width,T=yb.height,null===D||null===G||e!==ou(Wa))D=zu(this,2),G=zu(this,2),D[0].h(0,0),D[1].h(0,T),G[0].h(O,0),G[1].h(O,T)}else{var Pb=La();T=Cu(this,a,Wa,D,G,O,T,Pb);Va=T.x;D=Pb[0];G=Pb[1];O=T.width;T=T.height;Oa(Pb);P<yb.width&&0>Va&&(Du(a,-Va,0,Ea,Ma-1),Eu(D,-Va,0),Eu(G,-Va,0),Va=0)}Wa.V.h(Va,ba);y=Math.max(y,O);z=Math.max(z,B+(0===Y?0:q)+yb.height);P=O}else{0<n&&0<oa&&ba+p+yb.height>n&&(ba<f&&Au(a,k,0,f-ba,Ea,Ma-1),Y++,
oa=0,Ea=Ma,B=y,ba=0,P=135<e?-y-q:y+q);Bu(this,Wa,P,0);Va=0;if(0===oa){if(D=Wa.cr,G=Wa.rr,O=yb.width,T=yb.height,null===D||null===G||e!==ou(Wa))D=zu(this,2),G=zu(this,2),D[0].h(0,0),D[1].h(O,0),G[0].h(0,T),G[1].h(O,T)}else Pb=La(),T=Cu(this,a,Wa,D,G,O,T,Pb),Va=T.x,D=Pb[0],G=Pb[1],O=T.width,T=T.height,Oa(Pb),ba<yb.height&&0>Va&&(Du(a,0,-Va,Ea,Ma-1),Eu(D,0,-Va),Eu(G,0,-Va),Va=0);Wa.V.h(P,Va);z=Math.max(z,T);y=Math.max(y,B+(0===Y?0:q)+yb.width);ba=T}oa++}0<Y&&(b?(z+=Math.max(0,c),P<y&&Au(a,k,y-P,0,Ea,
h-1),0<u&&(l||Du(a,u,0,0,h-1),y+=u)):(y+=Math.max(0,c),ba<z&&Au(a,k,0,z-ba,Ea,h-1),0<u&&(l||Du(a,0,u,0,h-1),z+=u)));u=l=0;switch(k){case Fu:b?l+=y/2-a.focus.x-r/2:u+=z/2-a.focus.y-r/2;break;case Gu:0<Y?b?l+=y/2-a.focus.x-r/2:u+=z/2-a.focus.y-r/2:b?(X=g[0].V.x+g[0].ja.x,l+=X+(g[h-1].V.x+g[h-1].ja.x+2*g[h-1].focus.x-X)/2-a.focus.x-r/2):(X=g[0].V.y+g[0].ja.y,u+=X+(g[h-1].V.y+g[h-1].ja.y+2*g[h-1].focus.y-X)/2-a.focus.y-r/2);break;case pu:b?(l-=r,y+=r):(u-=r,z+=r);break;case uu:b?(l+=y-a.width+r,y+=r):
(u+=z-a.height+r,z+=r);break;case gu:b?1<h?l+=X+p/2-a.focus.x:l+=g[0].focus.x-a.focus.x+g[0].ja.x:1<h?u+=X+p/2-a.focus.y:u+=g[0].focus.y-a.focus.y+g[0].ja.y;break;case hu:b?l+=y+p/2-a.focus.x:u+=z+p/2-a.focus.y;break;case iu:break;default:v("Unhandled alignment value "+k.toString())}for(r=0;r<h;r++)X=g[r],b?X.V.h(X.V.x+X.ja.x-l,X.V.y+(135<e?(m?-z:-X.Ba.height)+X.ja.y-c:w+c+X.ja.y)):X.V.h(X.V.x+(135<e?(m?-y:-X.Ba.width)+X.ja.x-c:d+c+X.ja.x),X.V.y+X.ja.y-u);h=g=0;m?b?(y=Hu(a,y,l),0>l&&(l=0),135<e&&
(u+=z+c),z+=w+c,k===iu&&(g+=p/2+a.focus.x),h+=w+c):(135<e&&(l+=y+c),y+=d+c,z=Iu(a,z,u),0>u&&(u=0),k===iu&&(h+=p/2+a.focus.y),g+=d+c):b?(null===a.comments?d>y&&(y=Ju(k,d-y,0),g=y.x,h=y.y,y=d,l=0):y=Hu(a,y,l),0>l&&(g-=l,l=0),135<e&&(u+=z+c),z=Math.max(Math.max(z,w),z+w+c),h+=w+c):(135<e&&(l+=y+c),y=Math.max(Math.max(y,d),y+d+c),null===a.comments?w>z&&(z=Ju(k,0,w-z),g=z.x,h=z.y,z=w,u=0):z=Iu(a,z,u),0>u&&(h-=u,u=0),g+=d+c);if(0<Y)e=zu(this,4),Y=zu(this,4),b?(e[2].h(0,w+c),e[3].h(e[2].x,z),Y[2].h(y,e[2].y),
Y[3].h(Y[2].x,e[3].y)):(e[2].h(d+c,0),e[3].h(y,e[2].y),Y[2].h(e[2].x,z),Y[3].h(e[3].x,Y[2].y));else{e=zu(this,D.length+2);Y=zu(this,G.length+2);for(k=0;k<D.length;k++)m=D[k],e[k+2].h(m.x+g,m.y+h);for(k=0;k<G.length;k++)m=G[k],Y[k+2].h(m.x+g,m.y+h)}b?(e[0].h(l,0),e[1].h(e[0].x,w),e[2].y<e[1].y&&(e[2].x>e[0].x?e[2].assign(e[1]):e[1].assign(e[2])),e[3].y<e[2].y&&(e[3].x>e[0].x?e[3].assign(e[2]):e[2].assign(e[3])),Y[0].h(l+d,0),Y[1].h(Y[0].x,w),Y[2].y<Y[1].y&&(Y[2].x<Y[0].x?Y[2].assign(Y[1]):Y[1].assign(Y[2])),
Y[3].y<Y[2].y&&(Y[3].x<Y[0].x?Y[3].assign(Y[2]):Y[2].assign(Y[3])),e[2].y-=c/2,Y[2].y-=c/2):(e[0].h(0,u),e[1].h(d,e[0].y),e[2].x<e[1].x&&(e[2].y>e[0].y?e[2].assign(e[1]):e[1].assign(e[2])),e[3].x<e[2].x&&(e[3].y>e[0].y?e[3].assign(e[2]):e[2].assign(e[3])),Y[0].h(0,u+w),Y[1].h(d,Y[0].y),Y[2].x<Y[1].x&&(Y[2].y<Y[0].y?Y[2].assign(Y[1]):Y[1].assign(Y[2])),Y[3].x<Y[2].x&&(Y[3].y<Y[0].y?Y[3].assign(Y[2]):Y[2].assign(Y[3])),e[2].x-=c/2,Y[2].x-=c/2);Ku(this,D);Ku(this,G);a.cr=e;a.rr=Y;a.ja.h(l,u);a.Ba.h(y,
z)}break;default:v("Unhandled compaction value "+a.compaction.toString())}}};
function mu(a,b){F&&x(b,Lt,Z,"layoutTreeNone:v");if(0===b.childrenCount){var c=!1,d=0;null!==b.parent&&(d=b.parent.angle,c=b.parent.alignment,c=fu(c));var e=ku(b);b.V.h(0,0);b.Ba.h(b.width,b.height);null===b.parent||null===b.comments||(180!==d&&270!==d||c)&&!e?b.ja.h(0,0):180===d&&!c||(90===d||270===d)&&e?b.ja.h(b.width-2*b.focus.x,0):b.ja.h(0,b.height-2*b.focus.y)}else{d=ou(b);c=90===d||270===d;var f=0;e=b.children;for(var g=e.length,h=0;h<g;h++){var k=e[h];f=Math.max(f,c?k.Ba.width:k.Ba.height)}var l=
b.alignment,m=l===pu,n=l===uu;h=fu(l);var p=Math.max(0,b.breadthLimit);k=vu(b);var r=b.nodeSpacing,q=wu(b),u=m||n?0:q/2,w=b.rowSpacing,y=0;if(m||n||b.en||b.fn&&1===b.maxGenerationCount)y=Math.max(0,b.rowIndent);m=b.width;var z=b.height,B=0,D=0,G=0,O=0,T=0,P=0,ba=0,Y=0,oa=0,Ea=0;h&&!ju(l)&&135<d&&e.reverse();if(ju(l))if(1<g)for(var X=0;X<g;X++){var Ma=e[X],Wa=Ma.Ba;0===X%2&&X!==g-1?oa=Math.max(oa,(c?Wa.width:Wa.height)+Lu(Ma)-r):0!==X%2&&(Ea=Math.max(Ea,(c?Wa.width:Wa.height)+Lu(Ma)-r))}else 1===g&&
(oa=c?e[0].Ba.width:e[0].Ba.height);if(h)switch(l){case gu:case Xt:D=135>d?xu(b,e,oa,B,D):yu(b,e,oa,B,D);oa=D.x;B=D.width;D=D.height;break;case hu:for(a=0;a<g;a++)p=e[a],u=p.Ba,G=0===ba?0:w,c?(p.V.h(f-u.width,T+G),B=Math.max(B,u.width),D=Math.max(D,T+G+u.height),T+=G+u.height):(p.V.h(O+G,f-u.height),B=Math.max(B,O+G+u.width),D=Math.max(D,u.height),O+=G+u.width),ba++;break;case iu:for(f=0;f<g;f++)a=e[f],p=a.Ba,u=0===ba?0:w,c?(a.V.h(r/2+b.focus.x,T+u),B=Math.max(B,p.width),D=Math.max(D,T+u+p.height),
T+=u+p.height):(a.V.h(O+u,r/2+b.focus.y),B=Math.max(B,O+u+p.width),D=Math.max(D,p.height),O+=u+p.width),ba++}else for(Ea=0;Ea<g;Ea++)X=e[Ea],Ma=X.Ba,c?(0<p&&0<ba&&O+r+Ma.width>p&&(O<f&&Au(b,l,f-O,0,Y,Ea-1),P++,ba=0,Y=Ea,G=D,O=0,T=135<d?-D-w:D+w),Wa=0===ba?u:r,Bu(a,X,0,T),X.V.h(O+Wa,T),B=Math.max(B,O+Wa+Ma.width),D=Math.max(D,G+(0===P?0:w)+Ma.height),O+=Wa+Ma.width):(0<p&&0<ba&&T+r+Ma.height>p&&(T<f&&Au(b,l,0,f-T,Y,Ea-1),P++,ba=0,Y=Ea,G=B,T=0,O=135<d?-B-w:B+w),Wa=0===ba?u:r,Bu(a,X,O,0),X.V.h(O,T+Wa),
D=Math.max(D,T+Wa+Ma.height),B=Math.max(B,G+(0===P?0:w)+Ma.width),T+=Wa+Ma.height),ba++;0<P&&(c?(D+=Math.max(0,k),O<B&&Au(b,l,B-O,0,Y,g-1),0<y&&(n||Du(b,y,0,0,g-1),B+=y)):(B+=Math.max(0,k),T<D&&Au(b,l,0,D-T,Y,g-1),0<y&&(n||Du(b,0,y,0,g-1),D+=y)));y=n=0;switch(l){case Fu:c?n+=B/2-b.focus.x-q/2:y+=D/2-b.focus.y-q/2;break;case Gu:0<P?c?n+=B/2-b.focus.x-q/2:y+=D/2-b.focus.y-q/2:c?(l=e[0].V.x+e[0].ja.x,n+=l+(e[g-1].V.x+e[g-1].ja.x+2*e[g-1].focus.x-l)/2-b.focus.x-q/2):(l=e[0].V.y+e[0].ja.y,y+=l+(e[g-1].V.y+
e[g-1].ja.y+2*e[g-1].focus.y-l)/2-b.focus.y-q/2);break;case pu:c?(n-=q,B+=q):(y-=q,D+=q);break;case uu:c?(n+=B-b.width+q,B+=q):(y+=D-b.height+q,D+=q);break;case gu:case Xt:c?1<g?n+=oa+r/2-b.focus.x:n+=e[0].focus.x-b.focus.x+e[0].ja.x:1<g?y+=oa+r/2-b.focus.y:y+=e[0].focus.y-b.focus.y+e[0].ja.y;break;case hu:c?n+=B+r/2-b.focus.x:y+=D+r/2-b.focus.y;break;case iu:break;default:v("Unhandled alignment value "+l.toString())}for(q=0;q<g;q++)l=e[q],c?l.V.h(l.V.x+l.ja.x-n,l.V.y+(135<d?(h?-D:-l.Ba.height)+l.ja.y-
k:z+k+l.ja.y)):l.V.h(l.V.x+(135<d?(h?-B:-l.Ba.width)+l.ja.x-k:m+k+l.ja.x),l.V.y+l.ja.y-y);c?(B=Hu(b,B,n),0>n&&(n=0),135<d&&(y+=D+k),D=Math.max(Math.max(D,z),D+z+k)):(135<d&&(n+=B+k),B=Math.max(Math.max(B,m),B+m+k),D=Iu(b,D,y),0>y&&(y=0));b.ja.h(n,y);b.Ba.h(B,D)}}
function xu(a,b,c,d,e){F&&x(a,Lt,Z,"layoutBusChildrenPosDir:v");var f=b.length;if(0===f)return new L(c,0,d,e);if(1===f)return a=b[0],d=a.Ba.width,e=a.Ba.height,new L(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=90===ou(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var r=b[p],q=r.Ba,u=0===l?0:h;if(k){var w=Lu(r)-g;r.V.h(c-(q.width+w),n+u);d=Math.max(d,q.width+w);e=Math.max(e,n+u+q.height);n+=u+q.height}else w=Lu(r)-g,r.V.h(m+u,c-(q.height+w)),e=Math.max(e,q.height+w),d=Math.max(d,m+
u+q.width),m+=u+q.width;l++}l=0;r=m;p=n;k?(m=c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];w=u.Ba;var y=0===l?0:h;if(k){var z=Lu(u)-g;u.V.h(m+z,n+y);d=Math.max(d,m+w.width+z);e=Math.max(e,n+y+w.height);n+=y+w.height}else z=Lu(u)-g,u.V.h(m+y,n+z),d=Math.max(d,m+y+w.width),e=Math.max(e,n+w.height+z),m+=y+w.width;l++}1<f&&1===f%2&&(b=b[f-1],f=b.Ba,h=Mu(b),k?(b.V.h(c+g/2-b.focus.x-b.ja.x,e+h),k=c+g/2-b.focus.x-b.ja.x,d=Math.max(d,k+f.width),0>k&&(d-=k),e=Math.max(e,Math.max(p,n)+h+f.height),
0>b.V.x&&(c=Nu(a,b.V.x,!1,c,g))):(b.V.h(d+h,c+g/2-b.focus.y-b.ja.y),d=Math.max(d,Math.max(r,m)+h+f.width),n=c+g/2-b.focus.y-b.ja.y,e=Math.max(e,n+f.height),0>n&&(e-=n),0>b.V.y&&(c=Nu(a,b.V.y,!0,c,g))));return new L(c,0,d,e)}
function yu(a,b,c,d,e){F&&x(a,Lt,Z,"layoutBusChildrenNegDir:v");var f=b.length;if(0===f)return new L(c,0,d,e);if(1===f)return b=b[0],d=b.Ba.width,e=b.Ba.height,new L(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=270===ou(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var r=b[p],q=r.Ba,u=0===l?0:h;if(k){var w=Lu(r)-g;n-=u+q.height;r.V.h(c-(q.width+w),n);d=Math.max(d,q.width+w);e=Math.max(e,Math.abs(n))}else w=Lu(r)-g,m-=u+q.width,r.V.h(m,c-(q.height+w)),e=Math.max(e,q.height+w),d=Math.max(d,
Math.abs(m));l++}l=0;r=m;p=n;k?(m=c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];w=u.Ba;var y=0===l?0:h;if(k){var z=Lu(u)-g;n-=y+w.height;u.V.h(m+z,n);d=Math.max(d,m+w.width+z);e=Math.max(e,Math.abs(n))}else z=Lu(u)-g,m-=y+w.width,u.V.h(m,n+z),e=Math.max(e,n+w.height+z),d=Math.max(d,Math.abs(m));l++}1<f&&1===f%2&&(h=b[f-1],l=h.Ba,q=Mu(h),k?(h.V.h(c+g/2-h.focus.x-h.ja.x,-e-l.height-q),m=c+g/2-h.focus.x-h.ja.x,d=Math.max(d,m+l.width),0>m&&(d-=m),e=Math.max(e,Math.abs(Math.min(p,n))+q+l.height),
0>h.V.x&&(c=Nu(a,h.V.x,!1,c,g))):(h.V.h(-d-l.width-q,c+g/2-h.focus.y-h.ja.y),d=Math.max(d,Math.abs(Math.min(r,m))+q+l.width),n=c+g/2-h.focus.y-h.ja.y,e=Math.max(e,n+l.height),0>n&&(e-=n),0>h.V.y&&(c=Nu(a,h.V.y,!0,c,g))));for(a=0;a<f;a++)g=b[a],k?g.V.h(g.V.x,g.V.y+e):g.V.h(g.V.x+d,g.V.y);return new L(c,0,d,e)}function Lu(a){F&&x(a,Lt,Z,"fixRelativePostions:child");return null===a.parent?0:a.parent.nodeSpacing}
function Mu(a){F&&x(a,Lt,Z,"fixRelativePostions:lastchild");return null===a.parent?0:a.parent.rowSpacing}function Nu(a,b,c,d,e){F&&x(a,Lt,Z,"fixRelativePostions:v");a=a.children;for(var f=a.length,g=0;g<f;g++)c?a[g].V.h(a[g].V.x,a[g].V.y-b):a[g].V.h(a[g].V.x-b,a[g].V.y);b=a[f-1];return Math.max(d,c?b.ja.y+b.focus.y-e/2:b.ja.x+b.focus.x-e/2)}
function Hu(a,b,c){F&&x(a,Lt,Z,"calculateSubwidth:v");switch(a.alignment){case Gu:case Fu:return c+a.width>b&&(b=c+a.width),0>c&&(b-=c),b;case pu:return a.width>b?a.width:b;case uu:return 2*a.focus.x>b?a.width:b+a.width-2*a.focus.x;case gu:case Xt:return Math.max(a.width,Math.max(b,c+a.width)-Math.min(0,c));case hu:return a.width-a.focus.x+a.nodeSpacing/2+b;case iu:return Math.max(a.width,a.focus.x+a.nodeSpacing/2+b);default:return b}}
function Iu(a,b,c){F&&x(a,Lt,Z,"calculateSubheight:v");switch(a.alignment){case Gu:case Fu:return c+a.height>b&&(b=c+a.height),0>c&&(b-=c),b;case pu:return a.height>b?a.height:b;case uu:return 2*a.focus.y>b?a.height:b+a.height-2*a.focus.y;case gu:case Xt:return Math.max(a.height,Math.max(b,c+a.height)-Math.min(0,c));case hu:return a.height-a.focus.y+a.nodeSpacing/2+b;case iu:return Math.max(a.height,a.focus.y+a.nodeSpacing/2+b);default:return b}}
function Ju(a,b,c){F&&x(a,E,Z,"alignOffset:align");switch(a){case Fu:b/=2;c/=2;break;case Gu:b/=2;c/=2;break;case pu:c=b=0;break;case uu:break;default:v("Unhandled alignment value "+a.toString())}return new J(b,c)}function Au(a,b,c,d,e,f){F&&x(a,Lt,Z,"shiftRelPosAlign:v");F&&x(b,E,Z,"shiftRelPosAlign:align");b=Ju(b,c,d);Du(a,b.x,b.y,e,f)}function Du(a,b,c,d,e){F&&x(a,Lt,Z,"shiftRelPos:v");if(0!==b||0!==c)for(a=a.children;d<=e;d++){var f=a[d].V;f.x+=b;f.y+=c}}
function Bu(a,b,c,d){F&&(x(b,Lt,Z,"recordMidPoints:v"),A(c,"number",Z,"recordMidPoints:x"),A(d,"number",Z,"recordMidPoints:y"));var e=b.parent;switch(a.md){case Gt:for(a=b.sourceEdges;a.next();)b=a.value,b.fromVertex===e&&b.relativePoint.h(c,d);break;case Nt:for(a=b.destinationEdges;a.next();)b=a.value,b.toVertex===e&&b.relativePoint.h(c,d);break;default:v("Unhandled path value "+a.md.toString())}}function Eu(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}}
function Cu(a,b,c,d,e,f,g,h){F&&x(b,Lt,Z,"mergeFringes:parent");F&&x(c,Lt,Z,"mergeFringes:child");var k=ou(b),l=90===k||270===k,m=b.nodeSpacing;b=d;var n=e;d=f;var p=g,r=c.cr,q=c.rr;g=c.Ba;var u=l?Math.max(p,g.height):Math.max(d,g.width);if(null===r||k!==ou(c))r=zu(a,2),q=zu(a,2),l?(r[0].h(0,0),r[1].h(0,g.height),q[0].h(g.width,0),q[1].h(q[0].x,r[1].y)):(r[0].h(0,0),r[1].h(g.width,0),q[0].h(0,g.height),q[1].h(r[1].x,q[0].y));if(l){p=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=
0;c<n.length&&e<r.length;){f=n[c];var w=r[e];k=w.x;l=w.y;k+=d;var y=f;c+1<n.length&&(y=n[c+1]);var z=w;w=z.x;z=z.y;e+1<r.length&&(z=r[e+1],w=z.x,z=z.y,w+=d);var B=p;f.y===l?B=k-f.x:f.y>l&&f.y<z?B=k+(f.y-l)/(z-l)*(w-k)-f.x:l>f.y&&l<y.y&&(B=k-(f.x+(l-f.y)/(y.y-f.y)*(y.x-f.x)));B<p&&(p=B);y.y<=f.y?c++:z<=l?e++:(y.y<=z&&c++,z<=y.y&&e++)}p=d-p;p+=m;c=r;e=p;if(null===b||2>b.length||null===c||2>c.length)d=null;else{m=zu(a,b.length+c.length);for(d=f=k=0;f<c.length&&c[f].y<b[0].y;)l=c[f++],m[d++].h(l.x+e,
l.y);for(;k<b.length;)l=b[k++],m[d++].h(l.x,l.y);for(k=b[b.length-1].y;f<c.length&&c[f].y<=k;)f++;for(;f<c.length&&c[f].y>k;)l=c[f++],m[d++].h(l.x+e,l.y);c=zu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);Ku(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=zu(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].y<f[0].y;)y=n[c++],m[e++].h(y.x,y.y);for(;l<f.length;)y=f[l++],m[e++].h(y.x+k,y.y);for(f=f[f.length-1].y;c<n.length&&n[c].y<=f;)c++;for(;c<n.length&&n[c].y>f;)k=n[c++],m[e++].h(k.x,
k.y);f=zu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);Ku(a,m);e=f}f=Math.max(0,p)+g.width;g=u;Ku(a,b);Ku(a,r);Ku(a,n);Ku(a,q);h[0]=d;h[1]=e;return new L(p,0,f,g)}d=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=0;c<n.length&&e<r.length;)f=n[c],w=r[e],k=w.x,l=w.y,l+=p,y=f,c+1<n.length&&(y=n[c+1]),z=w,w=z.x,z=z.y,e+1<r.length&&(z=r[e+1],w=z.x,z=z.y,z+=p),B=d,f.x===k?B=l-f.y:f.x>k&&f.x<w?B=l+(f.x-k)/(w-k)*(z-l)-f.y:k>f.x&&k<y.x&&(B=l-(f.y+(k-f.x)/(y.x-f.x)*(y.y-f.y))),B<d&&(d=B),y.x<=f.x?
c++:w<=k?e++:(y.x<=w&&c++,w<=y.x&&e++);p-=d;p+=m;c=r;e=p;if(null===b||2>b.length||null===c||2>c.length)d=null;else{m=zu(a,b.length+c.length);for(d=f=k=0;f<c.length&&c[f].x<b[0].x;)l=c[f++],m[d++].h(l.x,l.y+e);for(;k<b.length;)l=b[k++],m[d++].h(l.x,l.y);for(k=b[b.length-1].x;f<c.length&&c[f].x<=k;)f++;for(;f<c.length&&c[f].x>k;)l=c[f++],m[d++].h(l.x,l.y+e);c=zu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);Ku(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=zu(a,n.length+f.length);
for(e=l=c=0;c<n.length&&n[c].x<f[0].x;)y=n[c++],m[e++].h(y.x,y.y);for(;l<f.length;)y=f[l++],m[e++].h(y.x,y.y+k);for(f=f[f.length-1].x;c<n.length&&n[c].x<=f;)c++;for(;c<n.length&&n[c].x>f;)k=n[c++],m[e++].h(k.x,k.y);f=zu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);Ku(a,m);e=f}f=u;g=Math.max(0,p)+g.height;Ku(a,b);Ku(a,r);Ku(a,n);Ku(a,q);h[0]=d;h[1]=e;return new L(p,0,f,g)}function zu(a,b){a=a.Hv[b];if(void 0!==a&&(a=a.pop(),void 0!==a))return a;a=[];for(var c=0;c<b;c++)a[c]=new J;return a}
function Ku(a,b){var c=b.length,d=a.Hv[c];void 0===d&&(d=[],a.Hv[c]=d);d.push(b)}
Z.prototype.arrangeTrees=function(){if(this.Kb===Mt)for(var a=this.Pb.iterator;a.next();){var b=a.value;if(b instanceof Lt){var c=b.node;if(null!==c){var d=c.position;c=d.x;d=d.y;isFinite(c)||(c=0);isFinite(d)||(d=0);Ou(this,b,c,d)}}}else{a=[];for(b=this.Pb.iterator;b.next();)c=b.value,c instanceof Lt&&a.push(c);switch(this.sorting){case bu:break;case cu:a.reverse();break;case du:a.sort(this.comparer);break;case eu:a.sort(this.comparer);a.reverse();break;default:v("Unhandled sorting value "+this.sorting.toString())}c=
this.arrangementOrigin;b=c.x;c=c.y;for(d=0;d<a.length;d++){var e=a[d];Ou(this,e,b+e.ja.x,c+e.ja.y);switch(this.Kb){case Jt:c+=e.Ba.height+this.Od.height;break;case Pu:b+=e.Ba.width+this.Od.width;break;default:v("Unhandled arrangement value "+this.Kb.toString())}}}};function Ou(a,b,c,d){if(null!==b){F&&x(b,Lt,Z,"assignAbsolutePositions:v");b.x=c;b.y=d;b=b.children;for(var e=b.length,f=0;f<e;f++){var g=b[f];Ou(a,g,c+g.V.x,d+g.V.y)}}}
Z.prototype.commitLayout=function(){this.Qw();this.commitNodes();this.Uv();this.isRouting&&this.commitLinks()};Z.prototype.commitNodes=function(){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)};
Z.prototype.Uv=function(){if(this.layerStyle===Ut){for(var a=this.Ax,b=[],c=null,d=this.network.vertexes.iterator;d.next();){var e=d.value;null===c?c=e.bounds.copy():c.Uc(e.bounds);var f=b[e.level];void 0===f?f=vu(e):f=Math.max(f,vu(e));b[e.level]=f}for(d=0;d<b.length;d++)void 0===b[d]&&(b[d]=0);90===this.angle||270===this.angle?(c.Oc(this.nodeSpacing/2,this.layerSpacing),d=new J(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.Oc(this.layerSpacing,this.nodeSpacing/2),d=new J(-this.layerSpacing/2,-this.nodeSpacing/
2));e=[];c=90===this.angle||270===this.angle?c.width:c.height;f=0;if(180===this.angle||270===this.angle)for(var g=0;g<a.length;g++)f+=a[g]+b[g];for(g=0;g<a.length;g++){var h=a[g]+b[g];270===this.angle?(f-=h,e.push(new L(0,f,c,h))):90===this.angle?(e.push(new L(0,f,c,h)),f+=h):180===this.angle?(f-=h,e.push(new L(f,0,h,c))):(e.push(new L(f,0,h,c)),f+=h)}this.commitLayers(e,d)}};Z.prototype.commitLayers=function(){};Z.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};
Z.prototype.Qw=function(){for(var a=this.Pb.iterator;a.next();){var b=a.value;b instanceof Lt&&Qu(this,b)}};function Qu(a,b){if(null!==b){F&&x(b,Lt,Z,"setPortSpotsTree:v");a.setPortSpots(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Qu(a,b[d])}}
Z.prototype.setPortSpots=function(a){F&&x(a,Lt,Z,"setPortSpots:v");var b=a.alignment;if(fu(b)){F&&x(a,Lt,Z,"setPortSpotsBus:v");F&&x(b,E,Z,"setPortSpots:align");var c=this.md===Gt,d=ou(a);switch(d){case 0:var e=sd;break;case 90:e=td;break;case 180:e=rd;break;default:e=qd}var f=a.children,g=f.length;switch(b){case gu:case Xt:for(b=0;b<g;b++){var h=f[b];h=(c?h.sourceEdges:h.destinationEdges).first();if(null!==h&&(h=h.link,null!==h)){var k=90===d||270===d?rd:qd;if(1===g||b===g-1&&1===g%2)switch(d){case 0:k=
rd;break;case 90:k=qd;break;case 180:k=sd;break;default:k=td}else 0===b%2&&(k=90===d||270===d?sd:td);c?(a.setsPortSpot&&(h.fromSpot=e),a.setsChildPortSpot&&(h.toSpot=k)):(a.setsPortSpot&&(h.fromSpot=k),a.setsChildPortSpot&&(h.toSpot=e))}}break;case hu:d=90===d||270===d?sd:td;for(f=c?a.destinationEdges:a.sourceEdges;f.next();)g=f.value.link,null!==g&&(c?(a.setsPortSpot&&(g.fromSpot=e),a.setsChildPortSpot&&(g.toSpot=d)):(a.setsPortSpot&&(g.fromSpot=d),a.setsChildPortSpot&&(g.toSpot=e)));break;case iu:for(d=
90===d||270===d?rd:qd,f=c?a.destinationEdges:a.sourceEdges;f.next();)g=f.value.link,null!==g&&(c?(a.setsPortSpot&&(g.fromSpot=e),a.setsChildPortSpot&&(g.toSpot=d)):(a.setsPortSpot&&(g.fromSpot=d),a.setsChildPortSpot&&(g.toSpot=e)))}}else if(c=ou(a),this.md===Gt)for(e=a.destinationEdges;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Ib())switch(c){case 0:d.fromSpot=sd;break;case 90:d.fromSpot=td;break;case 180:d.fromSpot=rd;break;default:d.fromSpot=qd}else d.fromSpot=a.portSpot;
if(a.setsChildPortSpot)if(a.childPortSpot.Ib())switch(c){case 0:d.toSpot=rd;break;case 90:d.toSpot=qd;break;case 180:d.toSpot=sd;break;default:d.toSpot=td}else d.toSpot=a.childPortSpot}}else for(e=a.sourceEdges;e.next();)if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Ib())switch(c){case 0:d.toSpot=sd;break;case 90:d.toSpot=td;break;case 180:d.toSpot=rd;break;default:d.toSpot=qd}else d.toSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Ib())switch(c){case 0:d.fromSpot=rd;break;
case 90:d.fromSpot=qd;break;case 180:d.fromSpot=sd;break;default:d.fromSpot=td}else d.fromSpot=a.childPortSpot}};function ou(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}function vu(a){F&&x(a,Lt,Z,"computeLayerSpacing:v");var b=ou(a);b=90===b||270===b;var c=a.layerSpacing;if(0<a.layerSpacingParentOverlap){var d=Math.min(1,a.layerSpacingParentOverlap);c-=b?a.height*d:a.width*d}c<(b?-a.height:-a.width)&&(c=b?-a.height:-a.width);return c}
function wu(a){F&&x(a,Lt,Z,"computeNodeIndent:v");var b=ou(a),c=a.nodeIndent;if(0<a.nodeIndentPastParent){var d=Math.min(1,a.nodeIndentPastParent);c+=90===b||270===b?a.width*d:a.height*d}return c=Math.max(0,c)}
ma.Object.defineProperties(Z.prototype,{roots:{configurable:!0,get:function(){return this.Pb},set:function(a){this.Pb!==a&&(x(a,I,Z,"roots"),this.Pb=a,this.D())}},path:{configurable:!0,get:function(){return this.Ep},set:function(a){this.Ep!==a&&(hb(a,Z,Z,"path"),this.Ep=a,this.D())}},treeStyle:{configurable:!0,get:function(){return this.zq},set:function(a){this.Kb!==a&&(hb(a,Z,Z,"treeStyle"),a===Ht||a===$t||a===au||a===Zt)&&(this.zq=a,this.D())}},layerStyle:{configurable:!0,
enumerable:!0,get:function(){return this.Is},set:function(a){this.Kb!==a&&(hb(a,Z,Z,"layerStyle"),a===It||a===Vt||a===Ut)&&(this.Is=a,this.D())}},comments:{configurable:!0,get:function(){return this.ld},set:function(a){this.ld!==a&&(A(a,"boolean",Z,"comments"),this.ld=a,this.D())}},arrangement:{configurable:!0,get:function(){return this.Kb},set:function(a){this.Kb!==a&&(hb(a,Z,Z,"arrangement"),a===Jt||a===Pu||a===Mt)&&(this.Kb=a,this.D())}},arrangementSpacing:{configurable:!0,
enumerable:!0,get:function(){return this.Od},set:function(a){x(a,Hb,Z,"arrangementSpacing");this.Od.A(a)||(this.Od.assign(a),this.D())}},rootDefaults:{configurable:!0,get:function(){return this.Y},set:function(a){this.Y!==a&&(x(a,Lt,Z,"rootDefaults"),this.Y=a,this.D())}},alternateDefaults:{configurable:!0,get:function(){return this.Z},set:function(a){this.Z!==a&&(x(a,Lt,Z,"alternateDefaults"),this.Z=a,this.D())}},sorting:{configurable:!0,get:function(){return this.Y.sorting},
set:function(a){this.Y.sorting!==a&&(hb(a,Z,Z,"sorting"),a===bu||a===cu||a===du||eu)&&(this.Y.sorting=a,this.D())}},comparer:{configurable:!0,get:function(){return this.Y.comparer},set:function(a){this.Y.comparer!==a&&(A(a,"function",Z,"comparer"),this.Y.comparer=a,this.D())}},angle:{configurable:!0,get:function(){return this.Y.angle},set:function(a){this.Y.angle!==a&&(A(a,"number",Z,"angle"),0===a||90===a||180===a||270===a?(this.Y.angle=a,this.D()):v("TreeLayout.angle must be 0, 90, 180, or 270"))}},
alignment:{configurable:!0,get:function(){return this.Y.alignment},set:function(a){this.Y.alignment!==a&&(hb(a,Z,Z,"alignment"),this.Y.alignment=a,this.D())}},nodeIndent:{configurable:!0,get:function(){return this.Y.nodeIndent},set:function(a){this.Y.nodeIndent!==a&&(A(a,"number",Z,"nodeIndent"),0<=a&&(this.Y.nodeIndent=a,this.D()))}},nodeIndentPastParent:{configurable:!0,get:function(){return this.Y.nodeIndentPastParent},set:function(a){this.Y.nodeIndentPastParent!==
a&&(A(a,"number",Z,"nodeIndentPastParent"),0<=a&&1>=a&&(this.Y.nodeIndentPastParent=a,this.D()))}},nodeSpacing:{configurable:!0,get:function(){return this.Y.nodeSpacing},set:function(a){this.Y.nodeSpacing!==a&&(A(a,"number",Z,"nodeSpacing"),this.Y.nodeSpacing=a,this.D())}},layerSpacing:{configurable:!0,get:function(){return this.Y.layerSpacing},set:function(a){this.Y.layerSpacing!==a&&(A(a,"number",Z,"layerSpacing"),this.Y.layerSpacing=a,this.D())}},layerSpacingParentOverlap:{configurable:!0,
enumerable:!0,get:function(){return this.Y.layerSpacingParentOverlap},set:function(a){this.Y.layerSpacingParentOverlap!==a&&(A(a,"number",Z,"layerSpacingParentOverlap"),0<=a&&1>=a&&(this.Y.layerSpacingParentOverlap=a,this.D()))}},compaction:{configurable:!0,get:function(){return this.Y.compaction},set:function(a){this.Y.compaction!==a&&(hb(a,Z,Z,"compaction"),a===lu||a===nu)&&(this.Y.compaction=a,this.D())}},breadthLimit:{configurable:!0,get:function(){return this.Y.breadthLimit},
set:function(a){this.Y.breadthLimit!==a&&(A(a,"number",Z,"breadthLimit"),0<=a&&(this.Y.breadthLimit=a,this.D()))}},rowSpacing:{configurable:!0,get:function(){return this.Y.rowSpacing},set:function(a){this.Y.rowSpacing!==a&&(A(a,"number",Z,"rowSpacing"),this.Y.rowSpacing=a,this.D())}},rowIndent:{configurable:!0,get:function(){return this.Y.rowIndent},set:function(a){this.Y.rowIndent!==a&&(A(a,"number",Z,"rowIndent"),0<=a&&(this.Y.rowIndent=a,this.D()))}},commentSpacing:{configurable:!0,
enumerable:!0,get:function(){return this.Y.commentSpacing},set:function(a){this.Y.commentSpacing!==a&&(A(a,"number",Z,"commentSpacing"),this.Y.commentSpacing=a,this.D())}},commentMargin:{configurable:!0,get:function(){return this.Y.commentMargin},set:function(a){this.Y.commentMargin!==a&&(A(a,"number",Z,"commentMargin"),this.Y.commentMargin=a,this.D())}},setsPortSpot:{configurable:!0,get:function(){return this.Y.setsPortSpot},set:function(a){this.Y.setsPortSpot!==a&&(A(a,
"boolean",Z,"setsPortSpot"),this.Y.setsPortSpot=a,this.D())}},portSpot:{configurable:!0,get:function(){return this.Y.portSpot},set:function(a){x(a,M,Z,"portSpot");this.Y.portSpot.A(a)||(this.Y.portSpot=a,this.D())}},setsChildPortSpot:{configurable:!0,get:function(){return this.Y.setsChildPortSpot},set:function(a){this.Y.setsChildPortSpot!==a&&(A(a,"boolean",Z,"setsChildPortSpot"),this.Y.setsChildPortSpot=a,this.D())}},childPortSpot:{configurable:!0,get:function(){return this.Y.childPortSpot},
set:function(a){x(a,M,Z,"childPortSpot");this.Y.childPortSpot.A(a)||(this.Y.childPortSpot=a,this.D())}},alternateSorting:{configurable:!0,get:function(){return this.Z.sorting},set:function(a){this.Z.sorting!==a&&(hb(a,Z,Z,"alternateSorting"),a===bu||a===cu||a===du||eu)&&(this.Z.sorting=a,this.D())}},alternateComparer:{configurable:!0,get:function(){return this.Z.comparer},set:function(a){this.Z.comparer!==a&&(A(a,"function",Z,"alternateComparer"),this.Z.comparer=a,this.D())}},
alternateAngle:{configurable:!0,get:function(){return this.Z.angle},set:function(a){this.Z.angle!==a&&(A(a,"number",Z,"alternateAngle"),0===a||90===a||180===a||270===a)&&(this.Z.angle=a,this.D())}},alternateAlignment:{configurable:!0,get:function(){return this.Z.alignment},set:function(a){this.Z.alignment!==a&&(hb(a,Z,Z,"alternateAlignment"),this.Z.alignment=a,this.D())}},alternateNodeIndent:{configurable:!0,get:function(){return this.Z.nodeIndent},set:function(a){this.Z.nodeIndent!==
a&&(A(a,"number",Z,"alternateNodeIndent"),0<=a&&(this.Z.nodeIndent=a,this.D()))}},alternateNodeIndentPastParent:{configurable:!0,get:function(){return this.Z.nodeIndentPastParent},set:function(a){this.Z.nodeIndentPastParent!==a&&(A(a,"number",Z,"alternateNodeIndentPastParent"),0<=a&&1>=a&&(this.Z.nodeIndentPastParent=a,this.D()))}},alternateNodeSpacing:{configurable:!0,get:function(){return this.Z.nodeSpacing},set:function(a){this.Z.nodeSpacing!==a&&(A(a,"number",Z,"alternateNodeSpacing"),
this.Z.nodeSpacing=a,this.D())}},alternateLayerSpacing:{configurable:!0,get:function(){return this.Z.layerSpacing},set:function(a){this.Z.layerSpacing!==a&&(A(a,"number",Z,"alternateLayerSpacing"),this.Z.layerSpacing=a,this.D())}},alternateLayerSpacingParentOverlap:{configurable:!0,get:function(){return this.Z.layerSpacingParentOverlap},set:function(a){this.Z.layerSpacingParentOverlap!==a&&(A(a,"number",Z,"alternateLayerSpacingParentOverlap"),0<=a&&1>=a&&(this.Z.layerSpacingParentOverlap=
a,this.D()))}},alternateCompaction:{configurable:!0,get:function(){return this.Z.compaction},set:function(a){this.Z.compaction!==a&&(hb(a,Z,Z,"alternateCompaction"),a===lu||a===nu)&&(this.Z.compaction=a,this.D())}},alternateBreadthLimit:{configurable:!0,get:function(){return this.Z.breadthLimit},set:function(a){this.Z.breadthLimit!==a&&(A(a,"number",Z,"alternateBreadthLimit"),0<=a&&(this.Z.breadthLimit=a,this.D()))}},alternateRowSpacing:{configurable:!0,get:function(){return this.Z.rowSpacing},
set:function(a){this.Z.rowSpacing!==a&&(A(a,"number",Z,"alternateRowSpacing"),this.Z.rowSpacing=a,this.D())}},alternateRowIndent:{configurable:!0,get:function(){return this.Z.rowIndent},set:function(a){this.Z.rowIndent!==a&&(A(a,"number",Z,"alternateRowIndent"),0<=a&&(this.Z.rowIndent=a,this.D()))}},alternateCommentSpacing:{configurable:!0,get:function(){return this.Z.commentSpacing},set:function(a){this.Z.commentSpacing!==a&&(A(a,"number",Z,"alternateCommentSpacing"),
this.Z.commentSpacing=a,this.D())}},alternateCommentMargin:{configurable:!0,get:function(){return this.Z.commentMargin},set:function(a){this.Z.commentMargin!==a&&(A(a,"number",Z,"alternateCommentMargin"),this.Z.commentMargin=a,this.D())}},alternateSetsPortSpot:{configurable:!0,get:function(){return this.Z.setsPortSpot},set:function(a){this.Z.setsPortSpot!==a&&(A(a,"boolean",Z,"alternateSetsPortSpot"),this.Z.setsPortSpot=a,this.D())}},alternatePortSpot:{configurable:!0,
enumerable:!0,get:function(){return this.Z.portSpot},set:function(a){x(a,M,Z,"alternatePortSpot");this.Z.portSpot.A(a)||(this.Z.portSpot=a,this.D())}},alternateSetsChildPortSpot:{configurable:!0,get:function(){return this.Z.setsChildPortSpot},set:function(a){this.Z.setsChildPortSpot!==a&&(A(a,"boolean",Z,"alternateSetsChildPortSpot"),this.Z.setsChildPortSpot=a,this.D())}},alternateChildPortSpot:{configurable:!0,get:function(){return this.Z.childPortSpot},set:function(a){x(a,
M,Z,"alternateChildPortSpot");this.Z.childPortSpot.A(a)||(this.Z.childPortSpot=a,this.D())}}});
var Ft=new E(Z,"PathDefault",-1),Gt=new E(Z,"PathDestination",0),Nt=new E(Z,"PathSource",1),bu=new E(Z,"SortingForwards",10),cu=new E(Z,"SortingReverse",11),du=new E(Z,"SortingAscending",12),eu=new E(Z,"SortingDescending",13),Fu=new E(Z,"AlignmentCenterSubtrees",20),Gu=new E(Z,"AlignmentCenterChildren",21),pu=new E(Z,"AlignmentStart",22),uu=new E(Z,"AlignmentEnd",23),gu=new E(Z,"AlignmentBus",24),Xt=new E(Z,"AlignmentBusBranching",25),hu=new E(Z,"AlignmentTopLeftBus",26),iu=new E(Z,"AlignmentBottomRightBus",
27),lu=new E(Z,"CompactionNone",30),nu=new E(Z,"CompactionBlock",31),Ht=new E(Z,"StyleLayered",40),au=new E(Z,"StyleLastParents",41),$t=new E(Z,"StyleAlternating",42),Zt=new E(Z,"StyleRootOnly",43),Jt=new E(Z,"ArrangementVertical",50),Pu=new E(Z,"ArrangementHorizontal",51),Mt=new E(Z,"ArrangementFixedRoots",52),It=new E(Z,"LayerIndividual",60),Vt=new E(Z,"LayerSiblings",61),Ut=new E(Z,"LayerUniform",62);Z.className="TreeLayout";Z.PathDefault=Ft;Z.PathDestination=Gt;Z.PathSource=Nt;
Z.SortingForwards=bu;Z.SortingReverse=cu;Z.SortingAscending=du;Z.SortingDescending=eu;Z.AlignmentCenterSubtrees=Fu;Z.AlignmentCenterChildren=Gu;Z.AlignmentStart=pu;Z.AlignmentEnd=uu;Z.AlignmentBus=gu;Z.AlignmentBusBranching=Xt;Z.AlignmentTopLeftBus=hu;Z.AlignmentBottomRightBus=iu;Z.CompactionNone=lu;Z.CompactionBlock=nu;Z.StyleLayered=Ht;Z.StyleLastParents=au;Z.StyleAlternating=$t;Z.StyleRootOnly=Zt;Z.ArrangementVertical=Jt;Z.ArrangementHorizontal=Pu;Z.ArrangementFixedRoots=Mt;Z.LayerIndividual=It;
Z.LayerSiblings=Vt;Z.LayerUniform=Ut;function Kt(a){iq.call(this,a)}la(Kt,iq);Kt.prototype.createVertex=function(){return new Lt(this)};Kt.prototype.createEdge=function(){return new Ru(this)};Kt.className="TreeNetwork";
function Lt(a){wq.call(this,a);this.Oa=!1;this.Hc=null;this.L=[];this.Vc=this.jb=this.W=this.Pa=0;this.ld=null;this.V=new J(0,0);this.Ba=new Hb(0,0);this.ja=new J(0,0);this.fn=this.en=this.lB=!1;this.rr=this.cr=null;this.dd=bu;this.Zc=Dq;this.dc=0;this.Db=Gu;this.Ss=this.Rs=0;this.Ts=20;this.Ae=50;this.Hs=0;this.Ur=nu;this.Mr=0;this.ft=25;this.Tr=this.et=10;this.Sr=20;this.st=!0;this.bt=ld;this.rt=!0;this.Pr=ld}la(Lt,wq);
Lt.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.dd=a.sorting,this.Zc=a.comparer,this.dc=a.angle,this.Db=a.alignment,this.Rs=a.nodeIndent,this.Ss=a.nodeIndentPastParent,this.Ts=a.nodeSpacing,this.Ae=a.layerSpacing,this.Hs=a.layerSpacingParentOverlap,this.Ur=a.compaction,this.Mr=a.breadthLimit,this.ft=a.rowSpacing,this.et=a.rowIndent,this.Tr=a.commentSpacing,this.Sr=a.commentMargin,this.st=a.setsPortSpot,this.bt=a.portSpot,this.rt=a.setsChildPortSpot,this.Pr=a.childPortSpot)};
ma.Object.defineProperties(Lt.prototype,{initialized:{configurable:!0,get:function(){return this.Oa},set:function(a){this.Oa!==a&&(A(a,"boolean",Lt,"initialized"),this.Oa=a)}},parent:{configurable:!0,get:function(){return this.Hc},set:function(a){this.Hc!==a&&(F&&null!==a&&x(a,Lt,Lt,"parent"),this.Hc=a)}},children:{configurable:!0,get:function(){return this.L},set:function(a){if(this.L!==a){null===a||Array.isArray(a)||xa(a,"Array",Lt,"children:value");if(null!==
a)for(var b=a.length,c=0;c<b;c++){var d=a[c];F&&x(d,Lt,Lt,"children")}this.L=a}}},level:{configurable:!0,get:function(){return this.Pa},set:function(a){this.Pa!==a&&(A(a,"number",Lt,"level"),this.Pa=a)}},descendantCount:{configurable:!0,get:function(){return this.W},set:function(a){this.W!==a&&(A(a,"number",Lt,"descendantCount"),this.W=a)}},maxChildrenCount:{configurable:!0,get:function(){return this.jb},set:function(a){this.jb!==a&&(A(a,"number",Lt,"maxChildrenCount"),
this.jb=a)}},maxGenerationCount:{configurable:!0,get:function(){return this.Vc},set:function(a){this.Vc!==a&&(A(a,"number",Lt,"maxGenerationCount"),this.Vc=a)}},comments:{configurable:!0,get:function(){return this.ld},set:function(a){if(this.ld!==a){null===a||Array.isArray(a)||xa(a,"Array",Lt,"comments:value");if(null!==a)for(var b=a.length,c=0;c<b;c++){var d=a[c];F&&x(d,U,Lt,"comments")}this.ld=a}}},sorting:{configurable:!0,get:function(){return this.dd},
set:function(a){this.dd!==a&&(hb(a,Z,Lt,"sorting"),this.dd=a)}},comparer:{configurable:!0,get:function(){return this.Zc},set:function(a){this.Zc!==a&&(A(a,"function",Lt,"comparer"),this.Zc=a)}},angle:{configurable:!0,get:function(){return this.dc},set:function(a){this.dc!==a&&(A(a,"number",Lt,"angle"),this.dc=a)}},alignment:{configurable:!0,get:function(){return this.Db},set:function(a){this.Db!==a&&(hb(a,Z,Lt,"alignment"),this.Db=a)}},nodeIndent:{configurable:!0,
enumerable:!0,get:function(){return this.Rs},set:function(a){this.Rs!==a&&(A(a,"number",Lt,"nodeIndent"),this.Rs=a)}},nodeIndentPastParent:{configurable:!0,get:function(){return this.Ss},set:function(a){this.Ss!==a&&(A(a,"number",Lt,"nodeIndentPastParent"),this.Ss=a)}},nodeSpacing:{configurable:!0,get:function(){return this.Ts},set:function(a){this.Ts!==a&&(A(a,"number",Lt,"nodeSpacing"),this.Ts=a)}},layerSpacing:{configurable:!0,get:function(){return this.Ae},
set:function(a){this.Ae!==a&&(A(a,"number",Lt,"layerSpacing"),this.Ae=a)}},layerSpacingParentOverlap:{configurable:!0,get:function(){return this.Hs},set:function(a){this.Hs!==a&&(A(a,"number",Lt,"layerSpacingParentOverlap"),this.Hs=a)}},compaction:{configurable:!0,get:function(){return this.Ur},set:function(a){this.Ur!==a&&(hb(a,Z,Lt,"compaction"),this.Ur=a)}},breadthLimit:{configurable:!0,get:function(){return this.Mr},set:function(a){this.Mr!==a&&(A(a,"number",
Lt,"breadthLimit"),this.Mr=a)}},rowSpacing:{configurable:!0,get:function(){return this.ft},set:function(a){this.ft!==a&&(A(a,"number",Lt,"rowSpacing"),this.ft=a)}},rowIndent:{configurable:!0,get:function(){return this.et},set:function(a){this.et!==a&&(A(a,"number",Lt,"rowIndent"),this.et=a)}},commentSpacing:{configurable:!0,get:function(){return this.Tr},set:function(a){this.Tr!==a&&(A(a,"number",Lt,"commentSpacing"),this.Tr=a)}},commentMargin:{configurable:!0,
enumerable:!0,get:function(){return this.Sr},set:function(a){this.Sr!==a&&(A(a,"number",Lt,"commentMargin"),this.Sr=a)}},setsPortSpot:{configurable:!0,get:function(){return this.st},set:function(a){this.st!==a&&(A(a,"boolean",Lt,"setsPortSpot"),this.st=a)}},portSpot:{configurable:!0,get:function(){return this.bt},set:function(a){x(a,M,Lt,"portSpot");this.bt.A(a)||(this.bt=a)}},setsChildPortSpot:{configurable:!0,get:function(){return this.rt},set:function(a){this.rt!==
a&&(A(a,"boolean",Lt,"setsChildPortSpot"),this.rt=a)}},childPortSpot:{configurable:!0,get:function(){return this.Pr},set:function(a){x(a,M,Lt,"childPortSpot");this.Pr.A(a)||(this.Pr=a)}},childrenCount:{configurable:!0,get:function(){return this.children.length}},relativePosition:{configurable:!0,get:function(){return this.V},set:function(a){this.V.set(a)}},subtreeSize:{configurable:!0,get:function(){return this.Ba},set:function(a){this.Ba.set(a)}},
subtreeOffset:{configurable:!0,get:function(){return this.ja},set:function(a){this.ja.set(a)}}});Lt.className="TreeVertex";function Ru(a){xq.call(this,a);this.xv=new J(0,0)}la(Ru,xq);
Ru.prototype.commit=function(){var a=this.link;if(null!==a&&!a.isAvoiding){var b=this.network.layout,c=null,d=null;switch(b.md){case Gt:c=this.fromVertex;d=this.toVertex;break;case Nt:c=this.toVertex;d=this.fromVertex;break;default:v("Unhandled path value "+b.md.toString())}if(null!==c&&null!==d)if(b=this.xv,0!==b.x||0!==b.y||c.lB){d=c.bounds;var e=ou(c),f=vu(c),g=c.rowSpacing;a.Ij();var h=a.curve===rg,k=a.isOrthogonal,l;a.di();if(k||h){for(l=2;4<a.pointsCount;)a.Gw(2);var m=a.i(1);var n=a.i(2)}else{for(l=
1;3<a.pointsCount;)a.Gw(1);m=a.i(0);n=a.i(a.pointsCount-1)}var p=a.i(a.pointsCount-1);0===e?(c.alignment===uu?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-wu(c))))):c.alignment===pu?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+wu(c))))):e=c.en||c.fn&&1===c.maxGenerationCount?d.top-c.ja.y+b.y:d.y+d.height/2+b.y,h?(a.m(l,m.x,e),l++,a.m(l,d.right+f,e),l++,a.m(l,d.right+f+(b.x-g)/3,e),l++,a.m(l,d.right+f+2*(b.x-g)/3,e),l++,a.m(l,d.right+f+(b.x-
g),e),l++,a.m(l,n.x,e)):(k&&(a.m(l,d.right+f/2,m.y),l++),a.m(l,d.right+f/2,e),l++,a.m(l,d.right+f+b.x-(k?g/2:g),e),l++,k&&a.m(l,a.i(l-1).x,n.y))):90===e?(c.alignment===uu?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-wu(c))))):c.alignment===pu?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+wu(c))))):e=c.en||c.fn&&1===c.maxGenerationCount?d.left-c.ja.x+b.x:d.x+d.width/2+b.x,h?(a.m(l,e,m.y),l++,a.m(l,e,d.bottom+f),l++,a.m(l,e,d.bottom+f+(b.y-g)/
3),l++,a.m(l,e,d.bottom+f+2*(b.y-g)/3),l++,a.m(l,e,d.bottom+f+(b.y-g)),l++,a.m(l,e,n.y)):(k&&(a.m(l,m.x,d.bottom+f/2),l++),a.m(l,e,d.bottom+f/2),l++,a.m(l,e,d.bottom+f+b.y-(k?g/2:g)),l++,k&&a.m(l,n.x,a.i(l-1).y))):180===e?(c.alignment===uu?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-wu(c))))):c.alignment===pu?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+wu(c))))):e=c.en||c.fn&&1===c.maxGenerationCount?d.top-c.ja.y+b.y:d.y+d.height/2+b.y,h?
(a.m(l,m.x,e),l++,a.m(l,d.left-f,e),l++,a.m(l,d.left-f+(b.x+g)/3,e),l++,a.m(l,d.left-f+2*(b.x+g)/3,e),l++,a.m(l,d.left-f+(b.x+g),e),l++,a.m(l,n.x,e)):(k&&(a.m(l,d.left-f/2,m.y),l++),a.m(l,d.left-f/2,e),l++,a.m(l,d.left-f+b.x+(k?g/2:g),e),l++,k&&a.m(l,a.i(l-1).x,n.y))):270===e?(c.alignment===uu?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-wu(c))))):c.alignment===pu?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+wu(c))))):e=c.en||c.fn&&1===c.maxGenerationCount?
d.left-c.ja.x+b.x:d.x+d.width/2+b.x,h?(a.m(l,e,m.y),l++,a.m(l,e,d.top-f),l++,a.m(l,e,d.top-f+(b.y+g)/3),l++,a.m(l,e,d.top-f+2*(b.y+g)/3),l++,a.m(l,e,d.top-f+(b.y+g)),l++,a.m(l,e,n.y)):(k&&(a.m(l,m.x,d.top-f/2),l++),a.m(l,e,d.top-f/2),l++,a.m(l,e,d.top-f+b.y+(k?g/2:g)),l++,k&&a.m(l,n.x,a.i(l-1).y))):v("Invalid angle "+e);a.Jf()}else b=d,F&&x(c,Lt,Ru,"adjustRouteForAngleChange:parent"),F&&x(b,Lt,Ru,"adjustRouteForAngleChange:child"),a=this.link,f=ou(c),f!==ou(b)&&(g=vu(c),h=c.bounds,c=b.bounds,0===
f&&c.left-h.right<g+1||90===f&&c.top-h.bottom<g+1||180===f&&h.left-c.right<g+1||270===f&&h.top-c.bottom<g+1||(a.Ij(),c=a.curve===rg,b=a.isOrthogonal,d=fu(this.fromVertex.alignment),a.di(),0===f?(f=h.right+g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.N(1,f-20,a.i(1).y),a.m(2,f-20,c),a.m(3,f,c),a.m(4,f+20,c),a.N(5,a.i(5).x,c)):b?d?a.N(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.N(2,f,a.i(2).y),a.N(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?a.N(1,f,a.i(2).y):2===a.pointsCount&&a.m(1,
f,a.i(1).y)):90===f?(f=h.bottom+g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.N(1,a.i(1).x,f-20),a.m(2,c,f-20),a.m(3,c,f),a.m(4,c,f+20),a.N(5,c,a.i(5).y)):b?d?a.N(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.N(2,a.i(2).x,f),a.N(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.N(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)):180===f?(f=h.left-g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.N(1,f+20,a.i(1).y),a.m(2,f+20,c),a.m(3,f,c),a.m(4,f-20,c),a.N(5,a.i(5).x,c)):b?d?a.N(3,a.i(2).x,a.i(4).y):
6===a.pointsCount&&(a.N(2,f,a.i(2).y),a.N(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?a.N(1,f,a.i(2).y):2===a.pointsCount&&a.m(1,f,a.i(1).y)):270===f&&(f=h.top-g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.N(1,a.i(1).x,f+20),a.m(2,c,f+20),a.m(3,c,f),a.m(4,c,f-20),a.N(5,c,a.i(5).y)):b?d?a.N(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.N(2,a.i(2).x,f),a.N(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.N(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)),a.Jf()))}};
ma.Object.defineProperties(Ru.prototype,{relativePoint:{configurable:!0,get:function(){return this.xv},set:function(a){this.xv.set(a)}}});Ru.className="TreeEdge";
Ta.prototype.initializeStandardTools=function(){this.eb("Action",new Rg,this.mouseDownTools);this.eb("Relinking",new lf,this.mouseDownTools);this.eb("LinkReshaping",new pg,this.mouseDownTools);this.eb("Rotating",new Pg,this.mouseDownTools);this.eb("Resizing",new Ig,this.mouseDownTools);this.eb("Linking",new ig,this.mouseMoveTools);this.eb("Dragging",new df,this.mouseMoveTools);this.eb("DragSelecting",new Ug,this.mouseMoveTools);this.eb("Panning",new Vg,this.mouseMoveTools);this.eb("ContextMenu",new Xg,
this.mouseUpTools);this.eb("TextEditing",new hh,this.mouseUpTools);this.eb("ClickCreating",new Sg,this.mouseUpTools);this.eb("ClickSelecting",new Qg,this.mouseUpTools)};Hn("Horizontal",new Mm);Hn("Spot",new Om);Hn("Table",new Sm);Hn("Viewbox",new Xm);Hn("TableRow",new Vm);Hn("TableColumn",new Wm);Hn("Graduated",new gn);Hn("Grid",new Ym);Gi.add("GraphLinksModel",Wq);Gi.add("TreeModel",jr);oq(ss,null);oq(Is,null);
var Su=qa.go,Tu={get licenseKey(){return Q.licenseKey},set licenseKey(a){Q.licenseKey=a},get version(){return Q.version},Group:Hf,EnumValue:E,List:H,Set:I,Map:Db,Point:J,Size:Hb,Rect:L,Margin:lc,Spot:M,Geometry:Fd,PathFigure:te,PathSegment:ue,InputEvent:we,DiagramEvent:ye,ChangedEvent:Ge,Model:W,GraphLinksModel:Hr,TreeModel:Mr,Binding:Yi,Transaction:Le,UndoManager:Me,CommandHandler:el,Tool:Oe,DraggingTool:df,DraggingInfo:mf,DraggingOptions:ef,LinkingBaseTool:Xf,LinkingTool:ig,RelinkingTool:lf,LinkReshapingTool:pg,
ResizingTool:Ig,RotatingTool:Pg,ClickSelectingTool:Qg,ActionTool:Rg,ClickCreatingTool:Sg,HTMLInfo:bf,ContextMenuTool:Xg,DragSelectingTool:Ug,PanningTool:Vg,TextEditingTool:hh,ToolManager:Ta,Animation:Dh,AnimationManager:zh,AnimationTrigger:ri,Layer:wi,Diagram:Q,Palette:Yk,Overview:al,Brush:Hl,GraphObject:N,Panel:V,RowColumnDefinition:gk,Shape:Yf,TextBlock:ih,TextBlockMetrics:Ao,Picture:mk,Part:S,Adornment:Te,Node:U,Link:R,Placeholder:Kg,Layout:Mi,LayoutNetwork:iq,LayoutVertex:wq,LayoutEdge:xq,GridLayout:$k,
PanelLayout:bm,CircularLayout:Nr,CircularNetwork:ds,CircularVertex:qs,CircularEdge:rs,ForceDirectedLayout:ss,ForceDirectedNetwork:ts,ForceDirectedVertex:Ds,ForceDirectedEdge:Hs,LayeredDigraphLayout:Is,LayeredDigraphNetwork:Ns,LayeredDigraphVertex:Dt,LayeredDigraphEdge:Et,TreeLayout:Z,TreeNetwork:Kt,TreeVertex:Lt,TreeEdge:Ru};
"object"===typeof Su&&Su.version&&v("WARNING: a `go` object on the root object is already defined.  "+("Debug"in Su?"debug ":"")+"version: "+Su.version+", replaced with version: "+Tu.version);Q.prototype.go=Tu;qa.go=Tu;("undefined"===typeof qa||"undefined"===typeof qa.module||"object"!==typeof qa.module.exports)&&qa.define&&"function"===typeof qa.define&&qa.define.amd&&qa.define(Tu);Tu.Debug=F;F.Iz(Tu); 'undefined'!==typeof module&&'object'===typeof module.exports&&(module.exports='undefined'!==typeof global?global.go:self.go); })();


export const go = (typeof global !== "undefined") ? global.go : self.go;

export const Group = go.Group;
export const EnumValue = go.EnumValue;
export const List = go.List;
export const Set = go.Set;
export const Map = go.Map;
export const Point = go.Point;
export const Size = go.Size;
export const Rect = go.Rect;
export const Margin = go.Margin;
export const Spot = go.Spot;
export const Geometry = go.Geometry;
export const PathFigure = go.PathFigure;
export const PathSegment = go.PathSegment;
export const InputEvent = go.InputEvent;
export const DiagramEvent = go.DiagramEvent;
export const ChangedEvent = go.ChangedEvent;
export const Model = go.Model;
export const GraphLinksModel = go.GraphLinksModel;
export const TreeModel = go.TreeModel;
export const Binding = go.Binding;
export const Transaction = go.Transaction;
export const UndoManager = go.UndoManager;
export const CommandHandler = go.CommandHandler;
export const Tool = go.Tool;
export const DraggingTool = go.DraggingTool;
export const DraggingInfo = go.DraggingInfo;
export const LinkingBaseTool = go.LinkingBaseTool;
export const LinkingTool = go.LinkingTool;
export const RelinkingTool = go.RelinkingTool;
export const LinkReshapingTool = go.LinkReshapingTool;
export const ResizingTool = go.ResizingTool;
export const RotatingTool = go.RotatingTool;
export const ClickSelectingTool = go.ClickSelectingTool;
export const ActionTool = go.ActionTool;
export const ClickCreatingTool = go.ClickCreatingTool;
export const HTMLInfo = go.HTMLInfo;
export const ContextMenuTool = go.ContextMenuTool;
export const DragSelectingTool = go.DragSelectingTool;
export const PanningTool = go.PanningTool;
export const TextEditingTool = go.TextEditingTool;
export const ToolManager = go.ToolManager;
export const Animation = go.Animation;
export const AnimationManager = go.AnimationManager;
export const AnimationTrigger = go.AnimationTrigger;
export const Layer = go.Layer;
export const Diagram = go.Diagram;
export const Palette = go.Palette;
export const Overview = go.Overview;
export const Brush = go.Brush;
export const GraphObject = go.GraphObject;
export const Panel = go.Panel;
export const RowColumnDefinition = go.RowColumnDefinition;
export const Shape = go.Shape;
export const TextBlock = go.TextBlock;
export const TextBlockMetrics = go.TextBlockMetrics;
export const Picture = go.Picture;
export const Part = go.Part;
export const Adornment = go.Adornment;
export const Node = go.Node;
export const Link = go.Link;
export const Placeholder = go.Placeholder;
export const Layout = go.Layout;
export const LayoutNetwork = go.LayoutNetwork;
export const LayoutVertex = go.LayoutVertex;
export const LayoutEdge = go.LayoutEdge;
export const GridLayout = go.GridLayout;
export const PanelLayout = go.PanelLayout;
export const CircularLayout = go.CircularLayout;
export const CircularNetwork = go.CircularNetwork;
export const CircularVertex = go.CircularVertex;
export const CircularEdge = go.CircularEdge;
export const ForceDirectedLayout = go.ForceDirectedLayout;
export const ForceDirectedNetwork = go.ForceDirectedNetwork;
export const ForceDirectedVertex = go.ForceDirectedVertex;
export const ForceDirectedEdge = go.ForceDirectedEdge;
export const LayeredDigraphLayout = go.LayeredDigraphLayout;
export const LayeredDigraphNetwork = go.LayeredDigraphNetwork;
export const LayeredDigraphVertex = go.LayeredDigraphVertex;
export const LayeredDigraphEdge = go.LayeredDigraphEdge;
export const TreeLayout = go.TreeLayout;
export const TreeNetwork = go.TreeNetwork;
export const TreeVertex = go.TreeVertex;
export const TreeEdge = go.TreeEdge;
export const version = go.version;
